Android: Get localized permission group names

。_饼干妹妹 提交于 2020-08-07 05:12:32

问题


In marshmallow's runtime permission, user can choose "never ask again" in permission requests. In this case, we have to redirect user to app settings to let them enable the permissions for the app. Also, Android permissions are group based, it will be very handy to display names of the permission groups that the app needs before we send the user to the settings.

I've seen the strings in android.Manifest such as "android.permission-group.LOCATION". Is it possible to get the permission group names programmatically?


回答1:


getPermissionGroupInfo() on PackageManager returns a PermissionGroupInfo for that group name (android.permission-group.LOCATION). On that, call loadLabel(), supplying the PackageManager as input, to get the human-readable name of the permission group. This should be localized for the user's chosen device locale.



来源:https://stackoverflow.com/questions/33899686/android-get-localized-permission-group-names

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!