1

Now I have special Intent for GoogleMaps only in my App. But some of the users don't have GoogleMaps installed on their device. I don't want to limit user to use only Google Maps app. Is there any way to show some picker which will show all installed navigation apps in his phone to choose from?

Now I have only GoogleMaps intent:

Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?"+(map.lastLocation?.run { "saddr=$latitude,$longitude&" }?:"")+"daddr="+dst.run { "$latitude,$longitude&travel_mode=$mapMode" }))
martin1337
  • 2,384
  • 6
  • 38
  • 85
  • Does this answer your question? [How to get list of apps that use location programmatically in Android?](https://stackoverflow.com/questions/36020864/how-to-get-list-of-apps-that-use-location-programmatically-in-android) – Viral Patel Dec 23 '19 at 11:26

1 Answers1

0

i'm not sure if it helps or not, but you can get the list all apps which use location using below code:

PackageManager pm = getPackageManager();
List packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo applicationInfo : packages) {
Log.d("test", "App: " + applicationInfo.name + " Package: " + 
applicationInfo.packageName);
try {
    PackageInfo packageInfo = pm.getPackageInfo(applicationInfo.packageName, PackageManager.GET_PERMISSIONS);
    //Get Permissions
    String[] requestedPermissions = packageInfo.requestedPermissions;
    if(requestedPermissions != null) {
        for (int i = 0; i < requestedPermissions.length; i++) {
            Log.d("test", requestedPermissions[i]);

            //////////////////////////////////////
            //////////////////////////////////////
            // Look for the desired permission here
            //////////////////////////////////////
            //////////////////////////////////////
        }
    }
} catch (NameNotFoundException e) {
    e.printStackTrace();
}

}

and add following line to your manifest file:

<uses-permission android:name="android.permission.GET_TASKS"/>