I am building an Android KIOSK app, and I try to enable kiosk mode with Android Management API by providing a device policy.
My policy json is:
{
"keyguardDisabled": true,
"applications": [
{
"packageName": "my.own.app",
"installType": "KIOSK",
"defaultPermissionPolicy": "GRANT"
}
]
}
What's interesting, the policy is from official API's example, so I suppose that works. Whatever, always get this error:
Error info persistentPreferredActivities 4
And just a google search does not give me any clue how to resolve this.
When I set installType
as KIOSK, I always got this error. My clue was that my policy lacks of PersistentPreferredActivity json block. I've added it, and I still got this error. What's interesting, there's a note: "Note: To set up a kiosk, use InstallType to KIOSK rather than use persistent preferred activities." So we do not need PersistentPreferredActivity. But I do not understand the error then.
Moving on. I've tried to make kiosk mode by setting kioskCustomLauncherEnabled to true. I set "installType": "AVAILABLE", so I can run the app from Android Studio. I applied the policy on a device successfully. When I try to open my app's Kiosk Activity I have "App is not device owner" Toast.
Basically, what I need is probably lockTaskAllowed
modifier, but it's deprecated.
Could somebody help me to make the device policy for KIOSK app, please?