1. Are you ready for the Galaxy S20? Here is everything we know so far!

Intent broadcast ACTION_USER_PRESENT not firing immediately?

Discussion in 'Android Development' started by sriram301296, Jan 16, 2016.

  1. sriram301296

    sriram301296 Lurker
    Thread Starter

    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

    1. Download the Forums for Android™ app!



Share This Page