How can I make my app usable when device is locked? Like when a timer/alarm goes off, I want it to be possible to access the entire app without unlocking the device.
Asked
Active
Viewed 535 times
-1
-
If you combine a BroadcastReceiver and an AlarmManger, this should work just fine. – Taslim Oseni May 12 '19 at 10:18
-
1Thank you Taslim, that helped me, giving me something valuable search-terms. – arberg May 14 '19 at 16:20
1 Answers
0
Here's a different question where the question doesn't really make sense due to permissions, but the accepted answer is exactly what I was looking for. See linked question for details about below code.
Window window = this.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
To implement an alarm see Background jobs: AlarmManager

arberg
- 4,148
- 4
- 31
- 39