Android获取已安装App的所有权限
如果想获取系统所有应用的权限,只需便利系统中所有的包。
public void getAppPemission() {
PackageManager pm = ();PackageInfo info;
try {
info = ("", PackageManager.GET_PERMISSIONS);
//String result = null;
String[] packagePermissions = ;
("name", );
if (packagePermissions != null) {
for (int i = 0; i < ; i++) {
("result", packagePermissions[i]);
}
} else {
("name", + ": no permissions");
}
} catch (NameNotFoundException e) {
();
}
}
结果如下: