Created
July 15, 2016 23:27
-
-
Save JosiasSena/a60b327bcafe4aed13f5d05c79ceb0ee to your computer and use it in GitHub Desktop.
Wakes up device/turns on screen. For example if a notification is received this will make sure that the devices screen lights up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void wakeUpPhone(Context context, String tag) { | |
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); | |
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(( | |
PowerManager.SCREEN_BRIGHT_WAKE_LOCK | | |
PowerManager.FULL_WAKE_LOCK | | |
PowerManager.ACQUIRE_CAUSES_WAKEUP), tag); | |
wakeLock.acquire(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment