'How to use WakeLock with "PowerManager.LOCATION_MODE_NO_CHANGE"?
I am trying to use
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.LOCATION_MODE_NO_CHANGE, "My Tag");
mWakeLock.acquire();
in onCreate method of Activity. But it is crashing my app. When I use
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
mWakeLock.acquire();
It works fine. (with PPARTIAL_WAKE_LOCK).
Solution 1:[1]
a little bit late to answer ;p ... Have you tried something like newWakeLock(PowerManager.PARTIAL_WAKE_LOCK or PowerManager.LOCATION_MODE_NO_CHANGE, "myTAG")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MattiahIT |
