How to Open specific activity page in KIOSK mode of an app?

226 Views Asked by At

I can open my app by making it to KIOSK in AMAPI (android management API) by applying this in policy:

... "applications": [

 {
  "packageName": "com.xxx.zzz",
  "installType": "KIOSK"
}

But when I want to open a specific activity page of app then it's not happening. For example, I want to open "otherActivity" page of my "com.xxx.zzz" package name of the app.

I have applied this but it's not working: ... "applications": [

 {
  "packageName": "com.xxx.zzz.otherActivity",
  "installType": "KIOSK"
}

& it was suppose to open the otherActivity page directly of the app but it's not happening!

2

There are 2 best solutions below

0
On BEST ANSWER

Kindly see the below solution, apply this code to first screen of your app (e.g splash)

 // In policy
 {
  "packageName": "com.xxx.zzz",
  "installType": "KIOSK"
 }      
   
// In app code
val devicePolicyManager=getSystemService(Context.DEVICE_POLICY_SERVICE)
 as DevicePolicyManager
val isKioskEnabled = devicePolicyManager.isLockTaskPermitted(packageName)
if(isKioskEnabled){
    // navigate to your screen
 }
0
On

Android Management API does not directly support the launching of specific activities within an app through the installType parameter or any other method.

The installType parameter with a value of "KIOSK" is designed to manage the deployment of apps in kiosk mode, where a designated app is the only application running on the device. It launches the app by calling the launcher activity of the mentioned app.

If you’d like to open a particular activity when the app is in kiosk mode you can detect when the app enters lockTaskMode and redirect the user to that activity.