问题
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