Android – How to launch Google map intent in android app with certain location, zoom level and marker

Try the following solution:

double latitude = 40.714728;
double longitude = -73.998672;
String label = "ABC Label";
String uriBegin = "geo:" + latitude + "," + longitude;
String query = latitude + "," + longitude + "(" + label + ")";
String encodedQuery = Uri.encode(query);
String uriString = uriBegin + "?q=" + encodedQuery + "&z=16";
Uri uri = Uri.parse(uriString);
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri);
startActivity(intent);

Credit goes here: Answer

I believe the problem had to do with the spaces in your label. Encoding the query string will eliminate the issue by replacing the spaces with valid characters

Leave a Comment