开发者

Android invoke activity after screen is unlocked

I'm looking to write an an开发者_Go百科droid 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


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.


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

A good tutorial here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜