• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Intent broadcast ACTION_USER_PRESENT not firing immediately?

Hey, I've been working on app that's similar to a lock screen and have to detect when the phone is unlocked and launch my MainActivity. After seeing on many such forums(SO mainly) I managed to achieve my goal and fire up the activity using the ACTION_USER_PRESENT intent receiver in the Manifest file ,as suggested by many SO users. However, sometimes the Activity gets called only a few seconds after the phone is unlocked(power button pressed). Is there any work around to invoke the activity AS SOON AS the phone is unlocked? Also, I read in few places that declaring ACTION_USER_PRESENT in the manifest does not work always. I could not manage to make the registerReceiver() work. Which method is best?

Any help is appreciated.
- Sriram
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones