Instantly share code, notes, and snippets.

What would you like to do?
Rise and Shine™, unlock and wake up your device automatically when you deploy from the IDE. Put this somewhere in your `src/debug/` code and run it when the application or main activity starts. Apache 2.
* Show the activity over the lockscreen and wake up the device. If you launched the app manually
* both of these conditions are already true. If you deployed from the IDE, however, this will
* save you from hundreds of power button presses and pattern swiping per day!
public static void riseAndShine(Activity activity) {
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE);
PowerManager.WakeLock lock =

This comment has been minimized.

androidfu commented Feb 8, 2015

Is there a reason that you don't just unlock the device when pushing from the IDE?


This comment has been minimized.

padiyodi commented Oct 3, 2018

Hi, Sorry for this question but I am a novice here. I need to wake my app using a certain device code (i.e a hardware interrupt when I plug in a certain hardware through the device power port), Is there a way I can do it ?, any help would be appreciated, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment