Reputation: 1086
1)Cordova(Webview) based android app.
2)Launch the app and screen times out peoperly as per device settings.
3)From application side we are not acquiring any SCREEN_BRIGHT_WAKE_LOCK or ON_AFTER_RELEASE.
4)When app put to background and brought to foreground, device screen light never times out.
4)From application side we are not acquiring any SCREEN_BRIGHT_WAKE_LOCK or ON_AFTER_RELEASE.
5)Basically when coming to foreground the PowerManager is acquire ON_AFTER_RELEASE | SCREEN_BRIGHT_WAKE_LOCK(0x2000000a) wake-lock on behalf of our app 10311 and screen is kept on.
Line 58354: 08-14 22:49:22.280 D/PowerManagerService( 1088): [api] acquire WakeLock flags=0x2000000a tag=WindowManager uid=1000 pid=1088
08-14 22:50:22.000 I/PowerManagerService( 1088): [PWL] SCREEN_BRIGHT_WAKE_LOCK 'WindowManager' ON_AFTER_RELEASE (uid=1000, pid=1088, ws=WorkSource{10311}) (elapsedTime=59719)
6)Starting Android System WebView 59.0.3071.25 beta(Fails to work) ( May 4, 2017)
screen timeout issue is seen.
7) Issue is not seen android 7.0 which uses chrome v59 as webview.
Device used: Note 4(5.0.1)
Webview version: 59.0.3071.125
Upvotes: 15
Views: 628
Reputation: 15200
You can try to use this plugin:
https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin
window.plugins.insomnia.keepAwake() to keep the screen awake
window.plugins.insomnia.allowSleepAgain() to allow sleep again
Upvotes: 2