How can I get all applications that have the internet permission in Android? How can I do that? any idea?
Asked
Active
Viewed 435 times
1 Answers
4
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
}
}