[APP] Wakey Droid - wake device over usb with adb

Search This thread

bdjnk

Member
Jul 15, 2010
33
14
Wakey Droid allows you to wake your Android device from your computer over USB with the command adb shell am start -a android.intent.action.MAIN -n bdjnk.android.wakeydroid/.Wakey.

It is incredibly simple and works great (for me at least) but I'm sure it could be made better. The entire code is right below. If you've any suggestions, let me know. (hehe, it rhymes).

Wakey.java
Code:
package bdjnk.android.wakeydroid;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.PowerManager;

public class Wakey extends Activity {

    private static PowerManager.WakeLock wakeLock;
	
    protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

        PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
      	wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,"okTag");
       	wakeLock.acquire();

       	wakeLock.release();
	Wakey.this.finish();
    }
}

AndroidManifest.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="bdjnk.android.wakeydroid"
      android:versionCode="2"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="4" />
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Wakey"
                  android:label="@string/app_name"
                  android:launchMode="singleInstance"
                  android:finishOnTaskLaunch="true"
                  android:noHistory="true"
                  android:stateNotNeeded="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.MONKEY" />
            </intent-filter>
        </activity>
    </application>
    <uses-permission android:name="android.permission.WAKE_LOCK" />  
</manifest>
 
Last edited:

the2dcour

Senior Member
Mar 17, 2011
464
587
Boston
only suggestion I would have is maybe some way to configure what kind of wakelock you get (other than editing your code ;)) Great app, just what I needed thanks.
 

palmerx

Senior Member
Aug 19, 2008
157
8
Cartago
Thanks for this useful tool. It is exactly what I was looking for. However, it doesn't work on my Xperia Mini Pro with Android 2.3.4. I installed the Wakey Droid on the phone and when I issue the command via adb the device doesn't wake up.

I have the latest ADB version working on my laptop. All ADB commands work properly.

This is what I get when I run the command:

C:\>adb shell am start -a android.intent.action.MAIN -n bdjnk.android.wakeydroid
/.Wakey
Starting: Intent { act=android.intent.action.MAIN cmp=bdjnk.android.wakeydroid/.
Wakey }

Any help will be greatly appreciated. :)
 

bdjnk

Member
Jul 15, 2010
33
14
New Version - Fundamental Changes

I've released a new version that should now work despite (unsecured) lock-screens. Overall it is a much better design and should work on more devices.

Complete source code:
http://bitmote.com/index.php?pages/Wakey-Droid

Listing on Google Play:
https://play.google.com/store/apps/details?id=bdjnk.android.wakeydroid

p.s. Apologies if I'm not supposed to be reviving dead threads (making zombies!), but I took a look through various posting rules and didn't see it mentioned.
 

ptosch

Member
Dec 31, 2008
26
4
APK where ?

Hello,

where can I download the apk directly, I do not use the Google store ?
 

hallwal

New member
Jan 7, 2013
3
3
Hello,

where can I download the apk directly, I do not use the Google store ?

Not sure if this only works on Jelly Bean or if it works on earlier versions of Android, but if you have adb already installed, try starting a shell by typing "adb shell" at a command prompt, and then type "input keyevent POWER" and your phone will wake up. You can then type "input keyevent MENU" to bypass your (unprotected) lock screen. (If you are interested or your touchscreen breaks, there are many other keyevent commands as well as tap and swipe commands which you can google.) :)

[PS: Your phone must be connected by usb. No app is needed.]
 
Last edited:

elichai2

Senior Member
Jul 15, 2012
71
5
Revava
It's not working for me, when i run it i get:
Code:
Starting: Intent { act=android.intent.action.MAIN cmp=bdjnk.android.wakeydroid/.Wakey. }
Error type 3
Error: Activity class {bdjnk.android.wakeydroid/bdjnk.android.wakeydroid.Wakey.} does not exist.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    Wakey Droid allows you to wake your Android device from your computer over USB with the command adb shell am start -a android.intent.action.MAIN -n bdjnk.android.wakeydroid/.Wakey.

    It is incredibly simple and works great (for me at least) but I'm sure it could be made better. The entire code is right below. If you've any suggestions, let me know. (hehe, it rhymes).

    Wakey.java
    Code:
    package bdjnk.android.wakeydroid;
    
    import android.app.Activity;
    import android.content.Context;
    import android.os.Bundle;
    import android.os.PowerManager;
    
    public class Wakey extends Activity {
    
        private static PowerManager.WakeLock wakeLock;
    	
        protected void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    
            PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
          	wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE,"okTag");
           	wakeLock.acquire();
    
           	wakeLock.release();
    	Wakey.this.finish();
        }
    }

    AndroidManifest.xml
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="bdjnk.android.wakeydroid"
          android:versionCode="2"
          android:versionName="1.0">
        <uses-sdk android:minSdkVersion="4" />
        <application android:icon="@drawable/icon" android:label="@string/app_name">
            <activity android:name=".Wakey"
                      android:label="@string/app_name"
                      android:launchMode="singleInstance"
                      android:finishOnTaskLaunch="true"
                      android:noHistory="true"
                      android:stateNotNeeded="true">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.MONKEY" />
                </intent-filter>
            </activity>
        </application>
        <uses-permission android:name="android.permission.WAKE_LOCK" />  
    </manifest>
    2
    New Version - Fundamental Changes

    I've released a new version that should now work despite (unsecured) lock-screens. Overall it is a much better design and should work on more devices.

    Complete source code:
    http://bitmote.com/index.php?pages/Wakey-Droid

    Listing on Google Play:
    https://play.google.com/store/apps/details?id=bdjnk.android.wakeydroid

    p.s. Apologies if I'm not supposed to be reviving dead threads (making zombies!), but I took a look through various posting rules and didn't see it mentioned.
    2
    Hello,

    where can I download the apk directly, I do not use the Google store ?

    Not sure if this only works on Jelly Bean or if it works on earlier versions of Android, but if you have adb already installed, try starting a shell by typing "adb shell" at a command prompt, and then type "input keyevent POWER" and your phone will wake up. You can then type "input keyevent MENU" to bypass your (unprotected) lock screen. (If you are interested or your touchscreen breaks, there are many other keyevent commands as well as tap and swipe commands which you can google.) :)

    [PS: Your phone must be connected by usb. No app is needed.]