Ric_harvey
Ric_harvey

Reputation: 55

Android invoke activity after screen is unlocked

I'm looking to write an android app that invokes a screen/activity after some one has entered the default android unlock pattern correctly.

I'm assuming that the best way to do this is run a service in the background that waits for this activity then on detecting this invokes an activity screen displaying the information?

Does that sound like a sensible way of doing things or is there a better way?

Also if anyone can point me at examples of this that would be amazing.

Cheers

Ric

Upvotes: 0

Views: 1177

Answers (2)

Francesco Laurita
Francesco Laurita

Reputation: 23552

Basically you need to register a BroadcastReceiver for the action ACTION_USER_PRESENT ACTION_USER_PRESENT is fired after ACTION_SCREEN_ON, usually when the keyguard is gone.

So create a handler and wait for ACTION_USER_PRESENT. When you got it, implement what you want for your activity.

Upvotes: 4

Shailendra Singh Rajawat
Shailendra Singh Rajawat

Reputation: 8242

Create a broadcast receiver to recieve boot_complete action then create a service and start it from onRecieve of broadcastReceiver .

A good tutorial here

Upvotes: 0

Related Questions