gpt4 book ai didi

android - 如何在 Android Things 上请求权限?

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:42:33 24 4
gpt4 key购买 nike

我正在尝试写入 AT 上的一个值。我已经在 list 中声明了所需的权限,

<uses-permission android:name="android.permission.WRITE_SETTINGS"/>

并尝试在运行时请求权限,AT 显示有关权限设置的窗口。但是,该开关不可点击。关于电话document

Requesting Permissions at Runtime is not supported because embedded devices aren't guaranteed to have a UI to accept the runtime dialog. Declare permissions that you need in your app's manifest file. All normal and dangerous permissions declared in your app's manifest are granted at install time.

但是 Settings.System.canWrite() 总是返回 false

是否有任何特殊方法来启用权限WRITE_SETTINGS

最佳答案

就像你说的,文档说:

Declare permissions that you need in your app's manifest file. All normal and dangerous permissions declared in your app's manifest are granted at install time.

因此您看不到正常的 Android 权限 UI。

来自发行说明:

Dangerous permissions requested by apps are not granted until the next device reboot. This includes new app installs and new elements in existing apps.

因此请尝试关闭和开启您的 Android Things 设备

关于android - 如何在 Android Things 上请求权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42281907/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com