79837532

Date: 2025-12-04 05:23:20
Score: 2
Natty:
Report link

This can be solved by using Lock Task Mode instead of screen pinning, done by adding your application package name to the allowlist for lock task packages.

The API Activity.startLockTask() remains the same, although you may want to provide a way to call Activity.stopLockTask() in your own UI, as unlike screen pinning, the user won't be able to unlock it using device gestures or device button combinations.

Note that this feature requires Device Owner / Device Policy Controller access (relatively difficult to obtain, tutorial link further below). Popular applications that allows you to use Device Owner features are:

I've built an application that makes use of this feature myself, Webview Kiosk.


As an aside, Device Owner privileges can also be shared using an application called Dhizuku (not to be confused with Shizuku), for apps that implements the Dhizuku API. Both OwnDroid and Webview Kiosk have implemented this natively, if you are looking for a reference implementation.

Dhizuku also provides a good tutorial in the following discussion post:

Reasons:
  • Blacklisted phrase (1.5): a good tutorial
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: nktnet