如何请求对Android Things的许可? [英] How to request permission on Android Things?

查看:88
本文介绍了如何请求对Android Things的许可?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to write to a value on AT. I've already declared required permission as follow in manifest,

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

并尝试在运行时请求权限,AT显示有关权限设置的窗口.但是,该开关不可单击.关于AT 文档

And try to request permission at run-time, AT shows windows regarding permission setup. However the switch is not clickable. Regarding AT document

由于嵌入,不支持在运行时请求权限 不能保证设备具有UI来接受运行时对话框. 在应用的清单文件中声明所需的权限.全部 在应用清单中声明的​​普通和危险权限为 在安装时授予.

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的特殊方法?

Are there any special methods to enable permission WRITE_SETTINGS?

推荐答案

使用AndroidManifest.xml上的语句安装应用程序之后,如下所示

After install application with the statement on AndroidManifest.xml as follow

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

还需要通过adb

adb shell am start -S com.android.settings/.Settings

然后单击APPS>YOUR_APP,然后单击permission.

现在,该开关是可单击的.因此,AT未被授予许可.需要手动授予它.

Now the switch is clickable. So AT not granted to permission. It needs to be granted manually.

这篇关于如何请求对Android Things的许可?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆