In the application,I am trying to a make activity show when user opens the screen lock (screen unlock) and when activity finish user open screen lock activity run back.I am trying
Intent.ACTION_SCREEN_ON
but it is not working properly. And I also used
USER_PRESENT
but I am not able get expected answer
I tried to find on google but was unsuccessful ,so I am confused how to make this type please tell me fast.
What version of Android are you targeting?
I have been able to get
USER_PRESENTworking fine on 2.x devices, by declaring it in the manifest.On 3.x & 4.x I was unable to get it working at first. On these later versions you need to run the activity at least once before the system will allow you to register for the event. This is not needed in 2.x.
I have succeeded with this on 2.x, 3.x and 4.x devices and it works. A simple option for an activity to run, if your app is a background app, is a welcome screen with configuration options on it. This would not be out of place in a background app, and satisfies the conditions.