How to request permission for Android Things?

I am trying to write a value to AT. I already declared the required permission, as shown in the manifest,

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

And try asking for permission at runtime, AT shows windows regarding resolution settings. However, the switch is not clickable. Regarding AT document

Requesting permissions in Runtime is not supported because embedded devices are not guaranteed that the user interface must accept the execution dialog. Declare the permissions required in the application manifest file. All the normal and dangerous permissions declared in your application manifest provided during installation.

However, it Settings.System.canWrite()always returns false.

Are there special methods for resolving permission WRITE_SETTINGS?

+4
source share
2 answers

After installing the application with instructions on AndroidManifest.xmlfollow

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

You must also run Settingsby followingadb

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

Then click APPS>YOUR_APP, then click permission.

Now the switch can be clicked. Therefore, AT is not granted permission. It must be provided manually.

+1
source

As you said, the docs say:

Declare the permissions required in the application manifest file. All normal and dangerous permissions declared in your application manifest are provided during installation.

Android.

:

, , . .

, Android Things

+8

Source: https://habr.com/ru/post/1669974/


All Articles