uses-permission android:name="android.permission.WAKE_LOCK permission issue
Solution 1
Use
<uses-permission android:name="android.permission.WAKE_LOCK" />
only, no extra code needed. Call acquire() to acquire the wake lock and force the device to stay on at the level that was requested when the wake lock was created.
Call release() when you are done and don't need the lock anymore. It is very important to do this as soon as possible to avoid running down the device's battery excessively.
Add all the uses-permission at the end of the manifest
Solution 2
Find the solution
As per my knowledge this is enough in Manifest file
<uses-permission android:name="android.permission.WAKE_LOCK"/>
For Screen continously ON write below logic
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
aj0822ArpitJoshi
I am working as a Android Developer,working in kotlin and i have 4 year experiance
Updated on March 23, 2020Comments
-
aj0822ArpitJoshi over 4 years
i am using this permission in my app and working fine in all devices and also in
Marhshmallow 6.0
device.There no need to
WAKE_LOCK
permission runtime because its normal permission but getting issue inNougat 7.0
devices.App getting crashed and error occur
"java.lang.SecurityException: Neither user 10799 nor current process has android.permission.WAKE_LOCK"
on linewakelock.acquire();
How to fix that?