Nit*_*der 15 android google-chrome android-webview
1)基于Cordova(Webview)的Android应用程序.
2)根据设备设置启动应用程序和屏幕超时.
3)从应用程序端,我们没有获取任何SCREEN_BRIGHT_WAKE_LOCK或ON_AFTER_RELEASE.
4)当应用程序放到后台并带到前台时,设备屏幕灯不会超时.
4)从应用程序端,我们没有获取任何SCREEN_BRIGHT_WAKE_LOCK或ON_AFTER_RELEASE.
5)基本上来到前台时,PowerManager获取ON_AFTER_RELEASE | SCREEN_BRIGHT_WAKE_LOCK(0x2000000a)代表我们的应用程序10311唤醒锁定并且屏幕保持打开状态.
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)
Run Code Online (Sandbox Code Playgroud)
6)启动Android系统WebView 59.0.3071.25 beta(无法正常工作)(2017年5月4日)
看到屏幕超时问题.
7)问题没有看到android 7.0使用chrome v59作为webview.
使用的设备:注4(5.0.1)
Webview版本:59.0.3071.125
你可以尝试使用这个插件:
https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin
window.plugins.insomnia.keepAwake() to keep the screen awake
window.plugins.insomnia.allowSleepAgain() to allow sleep again
Run Code Online (Sandbox Code Playgroud)