java – How to open a map application with a specific GPS position on Android?


I have the url,2.1704375,16z that positions Barcelona on the map, but I find that it does not come out, let's say the direction pointer, it only centers the map on you.

On my device I have several map apps:

  • Cytymapper
  • Google maps
  • Google Earth

The code I have to launch the Intent :

Uri uri = Uri.parse(",2.1704375,16z");
if (URLUtil.isValidUrl(uri.toString())) {
   startActivity( new Intent(Intent.ACTION_VIEW, uri));

I get an ActionList to choose Maps or Chrome , if I click on Maps it opens the maps application, but it does not show me the position with an indicator, it focuses on landmark and point.

If I indicate that it opens with chrome , another ActionList comes out, with the other map applications.

My doubts are:

  • How do I launch a specific Intent so that it can be opened with the Maps Apps?
  • How can I visualize the position marker within the map?


To display a location with a marker and label


To show the location of Barcelona


To show the ActionList that all the compatible applications appear to position a location

Uri uri = Uri.parse("geo:41.3825581,2.1704375?z=16&q=41.3825581,2.1704375(Barcelona)");
startActivity( new Intent(Intent.ACTION_VIEW, uri));

If you want to send the position directly to the Google Maps application

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:41.3825581,2.1704375?z=16&q=41.3825581,2.1704375(Barcelona)"));
                intent.setClassName("", "");


According to this answer in SO in English:

The form is this:

Uri intentUri = Uri.parse("geo:41.382,2.170?z=16&q=41.382,2.170(Esta+Es+La+Etiqueta)");
Intent intent = new Intent(Intent.ACTION_VIEW, intentUri);
Scroll to Top