2

I want to display some markers using the geo: intent to display a map at a specified location and zoom level. But I don't know how to add my markers here? Can somebody help me with this?

// Creates an Intent that will load a map of San Francisco
Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4194");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);

Thanks in advice for some help.

Cap
  • 57
  • 7
  • [Adding a Map with a Marker](https://developers.google.com/maps/documentation/android-sdk/map-with-marker) – Adarsh Vijayan P Nov 15 '19 at 08:40
  • But here I would need an Google Api Key. I wanted to put some markers in above map on only putting the coordinates in it. Does that only work with your solution and the api-Key? – Cap Nov 15 '19 at 08:46
  • Found a similar question [here](https://stackoverflow.com/questions/30569854/adding-multiple-markers-in-google-maps-api-v2-android) – Adarsh Vijayan P Nov 15 '19 at 09:17

1 Answers1

0

try the following example:

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:37.7749,-122.4194?q=37.7749,-122.4194 (San Francisco)"));
// the following line should be used if you want use only Google maps
intent.setComponent(new ComponentName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity"));
startActivity(intent);
mohammadReza Abiri
  • 1,679
  • 1
  • 7
  • 20
  • Thanks, this works well, but it only shows 1 Marker. What about showing 2 or 3 Markers? Do you have a solution for this? – Cap Nov 15 '19 at 08:59
  • No, its not solved, because your answer is good for 1 Marker, but I would like to have more than 1 Marker. – Cap Nov 18 '19 at 11:37