Reputation: 4728
I'm writing an app that will 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 !
Upvotes: 0
Views: 631
Reputation: 24031
You should register a BroadcastReceiver for screen_off
action and on it's onReceive()
method unlock the screen if required and launch your application.
Upvotes: 2