开发者

android automatic application restart if device is in homescreen and idle for a period of time

I'm writing an app that w开发者_高级运维ill be used in public transportation and I have a special requirement for it. I need the app to auto restart/bring to front somehow if all the following conditions are met:

-the user presses the back key or the home key and the app is minimized

-a period of time has passed since the device is idle

In conclusion I'd like to know what should I use, broadcast receivers or background services. Code snippets or examples would be appreciated :) Thank you !


You should register a BroadcastReceiver for screen_off action and on it's onReceive() method unlock the screen if required and launch your application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜