Best code examples for Android PowerManager class (android.os.PowerManager)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android PowerManager class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android PowerManager examples from Open Source projects
This code example shows how to use the following methods: newWakeLock, getClass
25:	mFullLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK 
-
28:	mPartialLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG); 
-
32:	Method method = mPowerManager.getClass().getDeclaredMethod("getSupportedWakeLockFlags"); 
-
37:	mProximityLock = mPowerManager.newWakeLock(proximityScreenOffWakeLock, LOG_TAG); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: newWakeLock
40:	lockStatic=mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: newWakeLock
134:	mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: newWakeLock
45:	this.wakeLock                     = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MMS Connection"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
109:	mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock, setBacklightBrightness
54:	PowerManager.WakeLock wl = mPm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "FULL_WAKE_LOCK"); 
-
57:	wl = mPm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "SCREEN_BRIGHT_WAKE_LOCK"); 
-
60:	wl = mPm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "SCREEN_DIM_WAKE_LOCK"); 
-
63:	wl = mPm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "PARTIAL_WAKE_LOCK"); 
-
135:	mPm.setBacklightBrightness(0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: newWakeLock, getClass
111:	Method method = mPowerManager.getClass().getDeclaredMethod( "isWakeLockLevelSupported", int.class ); 
-
116:	Method method = mPowerManager.getClass().getDeclaredMethod( "getSupportedWakeLockFlags" ); 
-
128:	mProximityWakeLock = mPowerManager.newWakeLock( proximityScreenOffWakeLock, TAG ); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
35:	assertNotNull(powerManager.newWakeLock(0, "TAG")); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
134:	mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isScreenOn
88:	return pm.isScreenOn(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
44:	mTimerWakeLock = mPowerManager.newWakeLock( 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
49:	mStartingService = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, CLASS_TAG); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isScreenOn, newWakeLock
267:	boolean isScreenOn = pm.isScreenOn(); 
-
271:	PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK |PowerManager.ACQUIRE_CAUSES_WAKEUP |PowerManager.ON_AFTER_RELEASE,"malcom_library_wakeup"); 
-
274:	PowerManager.WakeLock wl_cpu = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"malcom_library_cpuwakeup"); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
38:	lockStatic=mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, NAME); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
167:	wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKE_LOCK_TAG); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isScreenOn, newWakeLock
51:	if (pm.isScreenOn()) { 
-
57:	WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: newWakeLock
90:	pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: newWakeLock
326:	mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, mTag); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: reboot
65:	pm.reboot("recovery"); 
66:	pm.reboot(null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
24:	lockStatic = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: newWakeLock
48:	mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK_KEY); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isScreenOn
157:	if (!pm.isScreenOn()) { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: newWakeLock
47:	sWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOGTAG); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
35:	lockStatic = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, NAME); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: newWakeLock
58:	mStartingService = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
40:	m_saveWakelock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WAKELOCK); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: newWakeLock
22:	PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "YOUR TAG"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: newWakeLock
24:	mWakeLock = manager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, mTag); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: newWakeLock
34:	WakefulIntentService.lockStatic = mgr.newWakeLock( 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isScreenOn
31:	return pm.isScreenOn(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: reboot
132:	pm.reboot("bppanic"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: newWakeLock
39:	mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "SyncMyPix WakeLock"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: newWakeLock
57:	mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK     // Causes stay in the same state 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: reboot
132:	pm.reboot("bppanic"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isScreenOn, newWakeLock
196:	boolean isScreenOn = pm.isScreenOn(); 
197:	if(!isScreenOn ){final PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK|PowerManager.ACQUIRE_CAUSES_WAKEUP, "Toast_Event"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isScreenOn
30:	boolean __isScreenOn = __pm.isScreenOn(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isScreenOn, newWakeLock
27:	boolean screenOn = pm.isScreenOn(); 
-
31:	final PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK|PowerManager.ACQUIRE_CAUSES_WAKEUP, "Screen On"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isScreenOn, newWakeLock
21:	boolean screen = pm.isScreenOn(); 
-
28:	PowerManager.WakeLock  wakeLock = pm.newWakeLock(PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isScreenOn
128:	boolean ignore = !mPowerManager.isScreenOn(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isScreenOn
28:	return pm.isScreenOn(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isScreenOn
23:	assertTrue("Many tests will fail if the screen is not on.", pm.isScreenOn()); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: setBacklightBrightness
123:	power.setBacklightBrightness(brightness); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isScreenOn
99:	if (pm.isScreenOn()) { 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: goToSleep
26:	pm.goToSleep(SystemClock.uptimeMillis()); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: reboot
59:	pm.reboot(null); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: goToSleep
25:	pm.goToSleep(SystemClock.uptimeMillis() + 1); 
Full Snippet Info
4
CodeRank
This code example shows how to use the following methods: goToSleep
24:	pm.goToSleep(SystemClock.uptimeMillis()); 
Full Snippet Info
5
CodeRank
Related Android PowerManager Questions & Answers:
Other Android PowerManager Examples
9:	        if (wakeLock != null) wakeLock.release();
10:	
11:	        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
12:	        wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK |
13:	                PowerManager.ACQUIRE_CAUSES_WAKEUP |
-
9:	        if (wakeLock != null) wakeLock.release();
10:	
11:	        PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
12:	        wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK |
13:	                PowerManager.ACQUIRE_CAUSES_WAKEUP |

Read More

See Code Examples for Android PowerManager Methods: