I found a solution to this problem. It is a bit of a hack, but it seems to work.
1. I create a very simple activity (SDK 1.5) NoUnlockScreenActivity.java that does just this in its onCreate method: KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE); KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE); lock.disableKeyguard(); finish(); 2. Be sure to put this in your Manifest file: <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> (WRITE_EXTERNAL_STORAGE may be necessary as well for higher version SDKs). 3. After starting the emulator, do these adb commands: set SN= ... your emulator serial-num ... adb -s %SN% wait-for-device adb -s %SN% shell sleep 30 adb -s %SN% install -r C:\NoUnlockScreen.apk adb -s %SN% shell am start -n nounlock_package/ nounlock_package.NoUnlockScreenActivity >From this moment you can run the (re)installation of your actual app and test-app and run the 'shell am instrument' to run your test-app. On May 5, 4:05 pm, Streets Of Boston <flyingdutc...@gmail.com> wrote: > I'm writing some JUnit tests for my Android Activity. > They run fine and report proper results. > > However, when i automate the test and start the emulator, the emulator > starts with an unlock screen. This prevents the test from running > correctly. > > How do I start an emulator without the unlock screen so that it's > ready to run a test immediately? > Are there commands in the emulator.exe or adb.exe that can close/ > remove the unlock screen? > > Thanks! > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group > athttp://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en