Back to project page AndroidFortunes.
The source code is released under:
Apache License
If you think the Android project AndroidFortunes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.codechimp.util; // w ww .ja va 2s . c o m import android.content.Context; import android.os.PowerManager; public class WakeLock { private static PowerManager.WakeLock wakeLock; public static void acquire(Context context) { if (wakeLock != null && wakeLock.isHeld()) return; wakeLock = ((PowerManager) context .getSystemService(Context.POWER_SERVICE)).newWakeLock( PowerManager.PARTIAL_WAKE_LOCK, "Adhan Alarm Wake Lock"); wakeLock.acquire(); } public static void release() { if (wakeLock != null) { wakeLock.release(); wakeLock = null; } } }