Using below code you can retrieve all the permissions declared in Android Manifest file.
try {
PackageInfo pkgInfo = getPackageManager().getPackageInfo(mPkg, PackageManager.GET_PERMISSIONS);
String[] requestedPermissions = pkgInfo.requestedPermissions;
if (requestedPermissions == null) {
source.setText("No declared permissions");
} else {
String permissionsText = "";
for (int i = 0; i < pkgInfo.requestedPermissions.length; i++)
{
permissionsText += requestedPermissions[i] + "\n";
}
source.setText(permissionsText);
}
} catch (PackageManager.NameNotFoundException e) {
source.setText("Package Not Found");
}
No comments:
Post a Comment