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
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
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
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: isHeld, release
                        mCamera.stopPreview();
                        mCamera.release();
                        mCamera = null;
                        surfaceCreated = false;
                    } 
                    if (mWakeLock.isHeld())
                        mWakeLock.release();
                } else { 
                    if (!surfaceCreated) {
                        int[] textures = new int[1];
                        // generate one texture pointer and bind it as an 
                        // external texture. 
                        GLES20.glGenTextures(1, textures, 0);
                        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
                                textures[0]);
                        // No mip-mapping with camera source. 
                        GLES20.glTexParameterf(
                                GLES11Ext.GL_TEXTURE_EXTERNAL_OES,
                                GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
                        GLES20.glTexParameterf(
Full Snippet Info
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: release
    	} 
	} 
	 
	public static void releaseWakeLock() { 
    	if (mWakeLock != null) {
    		mWakeLock.release();
    		mWakeLock = null;
    	} 
	} 
} 
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
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");
      } 
    } 
  } 
 
Full Snippet Info
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: isHeld, release
        mWakeLock.acquire();
        Log.d(mTag, "Wake lock acquired");
    } 
 
    public void releaseWakeLock() { 
        if(mWakeLock != null && mWakeLock.isHeld()) {
            mWakeLock.release();
            Log.d(mTag, "Wake lock released");
        } 
    } 
} 
Full Snippet Info
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: acquire, release
		if (!showNotification) {
			// only play sound and return 
			RingtoneManager.getRingtone(getApplicationContext(), mConfig.notifySound).play();
			return; 
		} 
		mWakeLock.acquire();
		setNotification(fromJid, fromUserName, message);
		setLEDNotification(); 
		mNotification.sound = mConfig.notifySound;
		 
		int notifyId = 0;
		if (notificationId.containsKey(fromJid)) {
			notifyId = notificationId.get(fromJid);
		} else { 
			lastNotificationId++;
			notifyId = lastNotificationId;
			notificationId.put(fromJid, Integer.valueOf(notifyId));
		} 
 
		// If vibration is set to "system default", add the vibration flag to the  

7
CodeRank
Experience pair programming with AI  Get Codota for Java

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: