private String getString(String pkgName) {
StringBuffer sb = new StringBuffer();
PackageInfo pkgInfo = null;
if (pm == null) {
pm = getPackageManager();
}
try {
pkgInfo = pm.getPackageInfo(pkgName, PackageManager.GET_PERMISSIONS);
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] perms = pkgInfo.requestedPermissions;
for (String permName: perms) {
sb.append(permName).append('\n');
try {
PermissionInfo permInfo = pm.getPermissionInfo(permName, 0);
PermissionGroupInfo pgi = pm.getPermissionGroupInfo(permInfo.group, 0);
sb.append(permInfo.loadLabel(pm)).append('\n');
sb.append(permInfo.loadDescription(pm)).append("\n\n");
sb.append(pgi.loadLabel(pm)).append('\n');
sb.append(pgi.loadDescription(pm)).append("\n\n\n");
} catch (NameNotFoundException e) {
Log.i(TAG, e.toString());
sb.append("\n\n");
}
}
return sb.toString();
StringBuffer sb = new StringBuffer();
PackageInfo pkgInfo = null;
if (pm == null) {
pm = getPackageManager();
}
try {
pkgInfo = pm.getPackageInfo(pkgName, PackageManager.GET_PERMISSIONS);
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] perms = pkgInfo.requestedPermissions;
for (String permName: perms) {
sb.append(permName).append('\n');
try {
PermissionInfo permInfo = pm.getPermissionInfo(permName, 0);
PermissionGroupInfo pgi = pm.getPermissionGroupInfo(permInfo.group, 0);
sb.append(permInfo.loadLabel(pm)).append('\n');
sb.append(permInfo.loadDescription(pm)).append("\n\n");
sb.append(pgi.loadLabel(pm)).append('\n');
sb.append(pgi.loadDescription(pm)).append("\n\n\n");
} catch (NameNotFoundException e) {
Log.i(TAG, e.toString());
sb.append("\n\n");
}
}
return sb.toString();
}
参考:http://blog.csdn.net/feng88724/article/details/6198446