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?
Take note that KIOSK mode only works on fully managed devices. For a device to be fully managed, it must be provisioned from a setup wizard by using QR code containing an enrollment token or by other supported enrollment methods.
To be able to use the app in a policy, it must be available in Google Play. It should either be a public app or a private app that is made available to the enterprise (ID) you are managing with the Android Management API.
Here's the difference between "installType": "KIOSK" and kioskCustomLauncherEnabled:
"installType": "KIOSK" is used to pin a single app to the screen
policy_json = '''
{
"applications": [
{
"packageName": "com.google.android.gm",
"installType": "KIOSK",
"defaultPermissionPolicy": "GRANT"
}
],
"debuggingFeaturesAllowed": true
}
'''
Now, if you want to use a set of apps in KIOSK mode you can use kioskCustomLauncherEnabled
policy_json = '''
{
"applications": [
{
"packageName": "com.android.chrome",
"installType": "FORCE_INSTALLED",
"defaultPermissionPolicy": "GRANT"
},
{
"packageName": "com.google.android.gm",
"installType": "FORCE_INSTALLED",
"defaultPermissionPolicy": "GRANT"
}
],
"debuggingFeaturesAllowed": true,
"kioskCustomLauncherEnabled": true,
"keyguardDisabled": true
}
'''
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With