在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Android  網(wǎng)絡(luò)安全/ 安卓權(quán)限問題

安卓權(quán)限問題

怎么獲取權(quán)限的詳情,安卓有這個(gè)api嗎
打個(gè)比方,傳一個(gè)"android.permission.ACCESS_FINE_LOCATION"返回權(quán)限名稱"定位"和權(quán)限解釋"通過網(wǎng)絡(luò)或者衛(wèi)星對(duì)您的手機(jī)定位"
感覺自己寫好麻煩,大概翻了一下安卓API文檔沒找到

回答
編輯回答
薔薇花

應(yīng)該沒有類似的 API,因?yàn)楸旧矶x一個(gè)權(quán)限本身就沒有太多內(nèi)容,更沒有詳情。

2017年5月15日 23:28
編輯回答
影魅

明顯有這樣的 API: PermissionInfo
以 kotlin 為例使用如下代碼.

        val permissionInfo =  packageManager.getPermissionInfo("android.permission.ACCESS_FINE_LOCATION", PackageManager.GET_META_DATA)
        val desc = permissionInfo.loadDescription(packageManager)
        val label = getString(permissionInfo.labelRes)
        println("name:${permissionInfo.name}")
        println("desc:${desc}")
        println("label:${label}")

輸出如下:(因?yàn)槲沂窃谀M器下跑的,默認(rèn)是英文)

11-25 03:42:07.604 I/System.out: name:android.permission.ACCESS_FINE_LOCATION
11-25 03:42:07.604 I/System.out: desc:This app can get your location based on GPS or network location sources such as cell towers and Wi-Fi networks. These location services must be turned on and available on your phone for the app to be able to use them. This may increase battery consumption.
11-25 03:42:07.605 I/System.out: label:access precise location (GPS and network-based)
2018年3月30日 12:45