0

I want to do an intent filter with all gps apps installed in device.

I found this, but now, how I get the gps apps installed in device?

Anyone knows?

Thank you!

Community
  • 1
  • 1
apolo90
  • 57
  • 1
  • 9

1 Answers1

0

A crude, but the only, way would be to scan all the packages for apps that request the ACCESS_FINE_LOCATION permission.

This will give you a list of the apps that can use the GPS. It doesn't guarantee that they do use the GPS.

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 ACCURACY FINE permission
    }
}
Raghav Sood
  • 81,899
  • 22
  • 187
  • 195
  • I just put this: Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("google.navigation:q=an+address+city")); – apolo90 Mar 23 '13 at 16:48