开发者

How to launch an activity when lock screen is enabled?

开发者 https://www.devze.com 2023-02-14 09:44 出处:网络
How do you launch an activity when the lock screen is enabled? I want to be able to launch an activity as a result of the screen being locked. I already no I can make an activity work on top of the lo

How do you launch an activity when the lock screen is enabled? I want to be able to launch an activity as a result of the screen being locked. I already no I can make an activity work on top of the lock screen using WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED but it is a little un开发者_开发问答clear to me how to start the activity when the screen is locked. Do I need a service to be running that listens for the screen to lock and then launches the activity?


When the lock screen is enabled, you should programmatically unlock first the screen and launch the activity you want. After that, you can lock again the screen or do whatever you want. Maybe you can use a broadcast listener for lock screen if there is. You could try ACTION_SCREEN_OFF or create a service.

0

精彩评论

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