Vinith Jain
Vinith Jain

Reputation: 35

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

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!

Upvotes: 0

Views: 270

Answers (1)

Abhimanyu Goswami
Abhimanyu Goswami

Reputation: 38

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
 }

Upvotes: 1

Related Questions