Avoiding resuming app at lock screen

我与影子孤独终老i 提交于 2019-12-08 03:58:08

问题


I have a game which uses OpenGL ES for rendering. And it requires that I reload all the textures on resuming the app. When I press the homekey and exit (pause the app) and then resume it, it works fine. But when I use the power key to turn off the screen then turn on the screen, the app resumes at the lock screen itself (Slide to unlock screen). Is there anyway I can avoid this? Because the resume is not proper, if I unlock the screen after a slight delay (10 secs) the game will reload again and all I end up seeing is a white-screen. I want to mainly, if I can stop the app from resuming at the lock screen. I want the app to resume after the screen has been unlocked.

Thanks Akash


回答1:


you can try this in the activity.

getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);

it will show the application on top of the lock screen.




回答2:


It is because the screen shange, then you can use, for avoid restart:

android:configChanges="screenLayout|screenSize"



来源:https://stackoverflow.com/questions/8325395/avoiding-resuming-app-at-lock-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!