gpt4 book ai didi

android - 包装信息 : requestedPermissions vs permissions

转载 作者:行者123 更新时间:2023-11-29 19:34:26 32 4
gpt4 key购买 nike

requestedPermissionspermissions 有什么区别?

PackageInfo _pi = getPackageManager().getPackageInfo(this.getPackageName(), 
PackageManager.GET_PERMISSIONS);

// permissions
PermissionInfo[] _permissions = _pi.permissions;

// requestedPermissions
String[] _requestedPermissions = _pi.requestedPermissions;

是关于应用程序的权限和操作系统的权限吗?

谢谢

最佳答案

如文档所示

public PermissionInfo[]

Array of all <permission> tags included under <manifest>, or null if there were none.

int[] requestedPermissions

Array of all <uses-permission> tags included under <manifest>, or null if there were none.

所以 permissionInfo会有 attributesmanifest list 中的标签,例如

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.androidtest"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">

requstedPermissions 将返回 <uses-permission> 中的权限标签例如

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CAMERA" />

关于android - 包装信息 : requestedPermissions vs permissions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39421952/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com