I am writing a lock screen, there is a main activity ( MainActivity ) that contains the settings for the lock screen and the screen lock activity itself ( LockScreenActivity ), so: how to make the lock screen activity start automatically when the phone is turned on? Those. so that it is constantly running until the user disables it in the settings ( MainActivity )?
- 3Vladislav, if you have found a solution - bring it as an answer. This will help future visitors. - PashaPash ♦
|
1 answer
Use Broadcast Receiver - a mechanism that responds to broadcast messages. In short, a broadcast message can be, for example, some sort of system event that the BroadcastReceiver of an installed application can respond to. Turning on the phone is a broadcast message, so you can easily handle this event.
- Thanks, initially and used BroadcastReciver, only initially did not work, because I didn’t check the event for turning on the phone, so I decided to ask here) - Vladislav Golovlev
|