0

How can I get all applications that have the internet permission in Android? How can I do that? any idea?

HCarrasko
  • 2,193
  • 5
  • 30
  • 42

1 Answers1

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
    }
}
Community
  • 1
  • 1
Cat
  • 65,743
  • 23
  • 126
  • 140