Android 棉花糖权限
Android Marshmallow permissions
我正在开发一个需要
的应用程序
`<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />`
所以我想知道是否可以要求用户接受权限组而不是要求用户单独接受这些权限。在这种情况下,它是存储组。任何帮助表示赞赏。
根据此 link 您需要在需要时同时请求这两个权限,而不是同时请求。如果您请求一个权限,系统将请求该权限所属的整个组的权限。如果用户授予权限,您将获得整个组的权限。
The dialog box shown by the system describes the permission group your app needs access to; it does not list the specific permission. For example, if you request the READ_CONTACTS permission, the system dialog box just says your app needs access to the device's contacts. The user only needs to grant permission once for each permission group. If your app requests any other permissions in that group (that are listed in your app manifest), the system automatically grants them. When you request the permission, the system calls your onRequestPermissionsResult() callback method and passes PERMISSION_GRANTED, the same way it would if the user had explicitly granted your request through the system dialog box.
Note: Your app still needs to explicitly request every permission it needs, even if the user has already granted another permission in the same group. In addition, the grouping of permissions into groups may change in future Android releases. Your code should not rely on the assumption that particular permissions are or are not in the same group.
例如,假设您在应用清单中列出了 READ_CONTACTS 和 WRITE_CONTACTS。如果您请求 READ_CONTACTS 并且用户授予了权限,然后您请求 WRITE_CONTACTS,系统会立即授予您该权限,而无需与用户交互。
我正在开发一个需要
的应用程序 `<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />`
所以我想知道是否可以要求用户接受权限组而不是要求用户单独接受这些权限。在这种情况下,它是存储组。任何帮助表示赞赏。
根据此 link 您需要在需要时同时请求这两个权限,而不是同时请求。如果您请求一个权限,系统将请求该权限所属的整个组的权限。如果用户授予权限,您将获得整个组的权限。
The dialog box shown by the system describes the permission group your app needs access to; it does not list the specific permission. For example, if you request the READ_CONTACTS permission, the system dialog box just says your app needs access to the device's contacts. The user only needs to grant permission once for each permission group. If your app requests any other permissions in that group (that are listed in your app manifest), the system automatically grants them. When you request the permission, the system calls your onRequestPermissionsResult() callback method and passes PERMISSION_GRANTED, the same way it would if the user had explicitly granted your request through the system dialog box.
Note: Your app still needs to explicitly request every permission it needs, even if the user has already granted another permission in the same group. In addition, the grouping of permissions into groups may change in future Android releases. Your code should not rely on the assumption that particular permissions are or are not in the same group.
例如,假设您在应用清单中列出了 READ_CONTACTS 和 WRITE_CONTACTS。如果您请求 READ_CONTACTS 并且用户授予了权限,然后您请求 WRITE_CONTACTS,系统会立即授予您该权限,而无需与用户交互。