如何在使用 Android 管理 API 的 kiosk 模式中启用屏幕方向(横向和纵向)。

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

How to enable the screen orientation(Landscape and portrait) in kiosk mode using android management api

问题

在使用Android管理API实现kiosk模式设置时,我遇到了成功的实现。然而,我现在需要配置kiosk模式的显示屏方向。

以下是我的PolicyJson:

{
  "applications": [
    {
      "defaultPermissionPolicy": "GRANT",
      "installType": "FORCE_INSTALLED",
      "packageName": "com.google.android.apps.tachyon"
    },
    {
      "packageName": "com.google.youtube",
      "installType": "KIOSK"
    }
  ],

  "systemUpdate": {
    "type": "WINDOWED",
    "startMinutes": 120,
    "endMinutes": 240
  },
  "appAutoUpdatePolicy": "ALWAYS",
  "bluetoothContactSharingDisabled": true,
  "bluetoothDisabled": true,
  "bluetoothConfigDisabled": true,
  "advancedSecurityOverrides": {
    "developerSettings": "DEVELOPER_SETTINGS_ALLOWED"
  },
  "policyEnforcementRules": [
    {
      "settingName": "passwordPolicies",
      "blockAction": {
        "blockAfterDays": 1
      },
      "wipeAction": {
        "wipeAfterDays": 30
      }
    }
  ]
}

是否有人可以提供如何完成此任务的指导或说明?

英文:

While implementing the kiosk mode setup using the Android management API, I encountered a successful implementation. However, I now need to configure the display screen orientation for the kiosk mode.

here is my PolicyJson

{
  "applications": [
    {
      "defaultPermissionPolicy": "GRANT",
      "installType": "FORCE_INSTALLED",
      "packageName": "com.google.android.apps.tachyon"
    },
    {
      "packageName": "com.google.youtube",
      "installType": "KIOSK"
    }
  ],

  "systemUpdate": {
    "type": "WINDOWED",
    "startMinutes": 120,
    "endMinutes": 240
  },
  "appAutoUpdatePolicy": "ALWAYS",
  "bluetoothContactSharingDisabled": true,
  "bluetoothDisabled": true,
  "bluetoothConfigDisabled": true,
  "advancedSecurityOverrides": {
    "developerSettings": "DEVELOPER_SETTINGS_ALLOWED"
  },
  "policyEnforcementRules": [
    {
      "settingName": "passwordPolicies",
      "blockAction": {
        "blockAfterDays": 1
      },
      "wipeAction": {
        "wipeAfterDays": 30
      }
    }
  ]
}

Could someone please provide guidance or instructions on how to accomplish this task?

答案1

得分: 0

通过 API 直接配置显示屏方向目前不受支持,但您可以在应用 Kiosk 策略之前启用 "自动旋转模式" 设置来实现一种解决方法。

通过在设备上启用 "自动旋转模式",应用程序将根据设备的方向自动调整其方向。这样,应用程序将适应屏幕方向,而无需通过 API 显式配置。

以下是您可以遵循的步骤:

  1. 在应用 Kiosk 策略之前启用自动旋转模式设置。可以通过设备的系统设置完成此操作。
  2. 将设备旋转到首选方向。
  3. 使用 Android 管理 API 应用 Kiosk 策略,就像您已经实施的那样。
  4. 启用自动旋转模式后,以 Kiosk 模式安装的应用程序将根据设备的方向自动调整其方向。

这种解决方法确保 Kiosk 模式中的应用程序适应屏幕方向,无需通过 Android 管理 API 显式配置。

如果您是应用程序的开发人员,您还可以配置应用程序使用纵向或横向方向 - 更多信息请参阅这里

英文:

While configuring the display screen orientation directly through the API is not currently supported, you can achieve a workaround by enabling the auto-rotate mode setting before applying the Kiosk policy.

By enabling the ’auto-rotate mode’ on the device, the application will automatically adjust its orientation based on the device's orientation. This way, the application will adapt to the screen orientation without explicitly configuring it through the API.

Here are the steps you can follow:

  1. Enable the auto rotate mode setting before applying the Kiosk
    policy. This can be done through the device's system settings.
  2. Rotate the device to the preferred orientation.
  3. Apply the Kiosk policy using the Android Management API, as you have already implemented.
  4. With the auto-rotate mode enabled, the application installed in Kiosk mode will automatically adjust its orientation based on the device's orientation.

This workaround ensures that the application within the Kiosk mode adapts to the screen orientation without the need for explicit configuration through the Android Management API.

If you are the developer of the application, you can also configure the app to use portrait or landscape orientation - more here

huangapple
  • 本文由 发表于 2023年6月5日 21:38:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76406998.html
匿名

发表评论

匿名网友

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

确定