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

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

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(); 
9
CodeRank
Contextual code suggestions in your IDE  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. */ 
9
CodeRank
Contextual code suggestions in your IDE  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");
    	} 
    } 
 
} 
8
CodeRank
Contextual code suggestions in your IDE  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");
8
CodeRank
Contextual code suggestions in your IDE  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(
8
CodeRank
Contextual code suggestions in your IDE  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;
    	} 
	} 
} 
7
CodeRank
Contextual code suggestions in your IDE  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");
      } 
    } 
  } 
 
7
CodeRank
Contextual code suggestions in your IDE  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");
        } 
    } 
} 
8
CodeRank
Contextual code suggestions in your IDE  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
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:isHeld, release
				startProbe(); 
			} catch( IOException e ) {
				Log.e( TAG, "onHandleIntent : error", e );
			} finally { 
				 
    			if( wakeLock.isHeld() ) {
    				wakeLock.release();
    			} 
				 
				Intent completeIntent = new Intent( ACTION_COMPLETE );
				completeIntent.putExtra( EXTRA_COMPLETE, "Frontends are being discovered" );
			 
				sendBroadcast( completeIntent );
			} 
		} 
		 
		Log.v( TAG, "onHandleIntent : exit" );
	} 
 
	// jmDns interface 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related PowerManager.WakeLock release Questions & Answers:

Other PowerManager.WakeLock release Examples

7:	
8:	    public static void acquire(Context context) {
9:	        if (wakeLock != null) wakeLock.release();
10:	
11:	        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
-
17:	
18:	    public static void release() {
19:	        if (wakeLock != null) wakeLock.release(); wakeLock = null;
20:	    }
21:	}

Read More

release Method Overview
Releases the wake lock.
See Code Examples for other Android PowerManager.WakeLock Methods: