如何在应用程序的KIOSK模式中打开特定的活动页面?

huangapple go评论87阅读模式
英文:

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

问题

我可以通过在AMAPI(Android管理API)中将应用程序设置为KIOSK来打开我的应用程序,方法是在策略中应用以下内容:

  "applications": [

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

但是,当我想要打开应用程序的特定活动页面时,它并没有发生。例如,我想要打开我的应用程序“com.xxx.zzz”包名的“otherActivity”页面。

我尝试了以下方式,但没有效果:

  "applications": [

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

它本应该直接打开应用程序的otherActivity页面,但并没有发生!

英文:

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!

答案1

得分: 2

Android管理API不直接支持通过installType参数或任何其他方法启动应用程序中的特定活动。

具有值“KIOSK”的installType参数旨在管理在展示柜模式下部署应用程序,其中指定的应用程序是设备上唯一运行的应用程序。它通过调用所提及应用程序的启动器活动来启动应用程序。

如果您希望在应用程序处于展示柜模式时打开特定活动,您可以检测应用程序进入lockTaskMode时的情况并将用户重定向到该活动。

英文:

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.

答案2

得分: 1

请查看以下解决方案,将此代码应用于您应用的第一个屏幕(例如闪屏)。

// 在策略中
{
   "packageName": "com.xxx.zzz",
   "installType": "KIOSK"
}

// 在应用代码中
val devicePolicyManager = getSystemService(Context.DEVICE_POLICY_SERVICE)
    as DevicePolicyManager
val isKioskEnabled = devicePolicyManager.isLockTaskPermitted(packageName)
if (isKioskEnabled) {
    // 导航到您的屏幕
}
英文:

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
 }

huangapple
  • 本文由 发表于 2023年8月5日 01:35:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76838088.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定