避免在锁屏恢复应用程序

避免在锁屏恢复应用程序

本文介绍了避免在锁屏恢复应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个游戏,它使用的OpenGL ES渲染。它要求我重新加载恢复应用程序所有的纹理。当我preSS的Homekey酒店和退出(暂停应用程序),然后恢复它,它工作正常。但是当我使用电源键关闭屏幕再打开屏幕,应用程序恢复在锁屏本身(滑动解锁屏幕)。有反正我能避免这种情况?因为简历是不恰当的,如果我解锁屏幕稍有延迟后(10秒),游戏将再次刷新,所有我最后看到的是一个白色的屏幕。我想主要是,如果我可以恢复在锁屏停止应用程序。我希望应用程序恢复屏幕已解锁后。

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.

谢谢阿卡什

推荐答案

您可以在活动试试这个。

you can try this in the activity.

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

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

它会显示在锁屏界面顶部的应用程序。

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

这篇关于避免在锁屏恢复应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 07:19