Android Open Source - AndroidFortunes Wake Lock






From Project

Back to project page AndroidFortunes.

License

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.

Java Source Code

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;
    }
  }
}




Java Source Code List

org.codechimp.androidfortunes.AlarmHelper.java
org.codechimp.androidfortunes.AlarmReceiver.java
org.codechimp.androidfortunes.CloudyFortunesApiInterface.java
org.codechimp.androidfortunes.CloudyFortunesClient.java
org.codechimp.androidfortunes.GeneralUserPreferencesFragment.java
org.codechimp.androidfortunes.MainActivity.java
org.codechimp.androidfortunes.MobileListenerService.java
org.codechimp.androidfortunes.NotifyHelper.java
org.codechimp.androidfortunes.OnBootReceiver.java
org.codechimp.androidfortunes.Quote.java
org.codechimp.androidfortunes.SettingsActivity.java
org.codechimp.androidfortunes.WearActivity.java
org.codechimp.androidfortunes.WearListenerService.java
org.codechimp.util.TimePreference.java
org.codechimp.util.WakeLock.java