Android PowerManager.WakeLock - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android PowerManager.WakeLock class.

This code example shows how to use the following methods: isHeld, release
    if (connectivityListener != null) {
      context.unregisterReceiver(connectivityListener);
      connectivityListener = null;
    } 
 
    if (this.wakeLock.isHeld())
      this.wakeLock.release();
  } 
 
  private void issueConnectivityChange() { 
    Intent intent = new Intent(context, SendReceiveService.class);
    intent.setAction(getConnectivityAction());
    context.startService(intent);
  } 
 
  private class ConnectivityListener extends BroadcastReceiver {
    @Override 
    public void onReceive(Context context, Intent intent) {
      Log.w("MmsService", "Dispatching connectivity change...");
      issueConnectivityChange(); 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: acquire, isHeld, release, setReferenceCounted
    if (cpuWakeLock == null) {
      PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
      if (pm != null) {
        cpuWakeLock =
            pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG);
        cpuWakeLock.setReferenceCounted(true);
      } 
    } 
    if (cpuWakeLock != null) { //May be null if pm is null
      if (awake) {
        cpuWakeLock.acquire();
        L.d(TAG, "Adquired CPU lock");
      } else if (cpuWakeLock.isHeld()) {
        cpuWakeLock.release();
        L.d(TAG, "Released CPU lock");
      } 
    } 
  } 
 
  /** WiFi lock unique instance. */ 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isHeld, release
    	Log.d(TAG, "Wakelock " + WAKELOCK + " aquired");
    } 
     
    public static void releaseWakelock() 
    { 
    	if ((m_saveWakelock != null) && (m_saveWakelock.isHeld()))
    	{ 
    		m_saveWakelock.release();
    		Log.d(TAG, "Wakelock " + WAKELOCK + " released");
    	} 
    } 
 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: release
        Log.d(TAG, "WakeLock acquired");
    } 
 
    private void stopWakeLock() { 
        if (wakeLock != null) {
            wakeLock.release();
            Log.d(TAG, "WakeLock released");
        } 
    } 
 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.torch_toggle);
        surfaceView = (SurfaceView) this.findViewById(R.id.surfaceview);
        surfaceHolder = surfaceView.getHolder();
        surfaceHolder.addCallback(this);
        prefs = getSharedPreferences("torch", Context.MODE_WORLD_READABLE);
        Log.i(TAG, "onCreate");
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: acquire
			wifiLock.release();
	} 
 
	public void onWakeLockSettingsChanged() { 
		if (SettingsManager.connectionWakeLock()) 
			wakeLock.acquire();
		else 
			wakeLock.release();
	} 
 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android PowerManager.WakeLock Questions & Answers:

Other Android PowerManager.WakeLock Examples

4:	
5:	public abstract class WakeLocker {
6:	    private static PowerManager.WakeLock wakeLock;
7:	
8:	    public static void acquire(Context context) {

Read More

See Code Examples for Android PowerManager.WakeLock Methods: