Open map at given location

This commit is contained in:
misaochan 2016-09-01 17:37:22 +12:00
parent 064fc63265
commit d1da89ca5b

View file

@ -143,11 +143,10 @@ public class NearbyListFragment extends ListFragment {
Log.d(TAG, "Item at position " + position + " has coords: Lat: " + latitude + " Long: " + longitude); Log.d(TAG, "Item at position " + position + " has coords: Lat: " + latitude + " Long: " + longitude);
Uri gmmIntentUri = Uri.parse("geo:" + latitude + "," + longitude + '"'); //Open map app at given position
Uri gmmIntentUri = Uri.parse("geo:0,0?q=" + latitude + "," + longitude + '"');
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
if (mapIntent.resolveActivity(getActivity().getPackageManager()) != null) { if (mapIntent.resolveActivity(getActivity().getPackageManager()) != null) {
startActivity(mapIntent); startActivity(mapIntent);
} }