某些Android应用使用其权限向手机号码发送短信以从用户处提取资金。
如何检测哪些Android应用使用其权限发送短信?
答案 0 :(得分:0)
这可能会有所帮助
final PackageManager pm = getPackageManager();
final List<ApplicationInfo> Apps = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for ( ApplicationInfo app : Apps ) {
// Info we can fetch app.packageName,app.uid, app.sourceDir
// for Permissions:
StringBuffer permissions = new StringBuffer();
try {
PackageInfo packageInfo = pm.getPackageInfo(app.packageName, PackageManager.GET_PERMISSIONS);
String[] requestedPermissions = packageInfo.requestedPermissions;
if ( requestedPermissions != null ) {
for (int i = 0; i < requestedPermissions.length; i++) {
permissions.append(requestedPermissions[i] + "\n");
}
// fetch permissions
}
}
catch ( PackageManager.NameNotFoundException e ) {
e.printStackTrace();
}
}