I own a Kindle Fire with Fire OS version 5.1.4
I set my app as a Device Administrator and it worked well (my app shown the little toast saying "yeah I am the administrator" :) )
The problem is that calling startLockTask has no effect at all: the annoying green screen pinning dialog will appear anyway and the app is not locked.
My goal is to develop a kiosk app but as for now the user can simply drag the status bar and leave the app..
Are there any workarounds?
This is my onCreate
:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ComponentName deviceAdmin = new ComponentName(this, KioskSystemEventsReceiver.class);
DevicePolicyManager mDpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
if (!mDpm.isAdminActive(deviceAdmin)) {
Toast.makeText(this, "WARNING: i'm not the device admin", Toast.LENGTH_LONG).show();
// not shown
}
if (mDpm.isDeviceOwnerApp(getPackageName())) {
mDpm.setLockTaskPackages(deviceAdmin, new String[]{getPackageName()});
} else {
Toast.makeText(this, "WARNING: i'm not the device owner", Toast.LENGTH_LONG).show();
// not shown
}
startLockTask();
[...]