In setLockTaskPackages() used to specify which applications (through their package names) will be programmatically fixed without user confirmation . setLockTaskPackages() is called from the device owner’s application (most likely in your DeviceAdminReceiver onEnabled() method).
So, in your owner device app, you will have something like:
mDPM.setLockTaskPackages("com.foo.myapp");
and then in your application “com.foo.myapp” you will be authorized to call:
startLockTask();
Your application will immediately enter Pinning mode without user confirmation.
If you are not the first to register your application with setLockTaskPackages , the application will be pinned, but first the user will have to confirm.
Also note that when an application is registered with setLockTaskPackages() , it has several different types of behavior than manual output:
- user cannot manually disable the application by tapping Back + Recent Apps. You will have to programmatically disable your application using
stopLockTask() ; - The Home and Recent Apps buttons are invisible (not displayed)
- When the application is disconnected (via stopLockTask ()), the user will immediately return to Home: the screen lock will not be displayed, even if Keyguard is installed (template, code, or any Keyguard screen).
Florent Dupont Jan 29 '15 at 11:03 2015-01-29 11:03
source share