How can I get all applications that have the internet permission in Android? How can I do that? any idea?
You need to iterate over all installed apps, using the PackageManager.GET_PERMISSIONS
flag. You can then check if the internet permission is in the returned value.
Sample code (based on this answer ):
PackageManager p = context.getPackageManager();
final List<PackageInfo> apps = p.getInstalledPackages(PackageManager.GET_PERMISSIONS);
for (PackageInfo pkg : apps) {
for (String permission : pkg.requestedPermissions) {
// Check if permission is the internet permission
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.