Google Maps URL Schema Does Not Display Token

I use Google Maps URL Scheme to open the Google Map application on iOS, I have schema :

 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"comgooglemaps://?center=35.6653,139.6959&zoom=16&views=traffic&mapmode=standard"]]; 

But when I launch the application, the result does not show a marker in the location (35.6653,139.6959).

enter image description here

How to display a marker?

+5
source share
3 answers

You can show the marker, as when transmitting Latitude and Longitude in a URL, for example

  [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://maps.google.com/maps?q=35.6653,139.6959"]]; 
+10
source

Here you have a way to open the Google Maps website or the Google Maps application using the marker on it.

 - (void) onPositionPressed:(UITapGestureRecognizer*)sender{ NSNumber * latitude = [sender.view associativeObjectForKey:@"latitude"]; NSNumber * longitude = [sender.view associativeObjectForKey:@"longitude"]; if(latitude && longitude){ //Abrimos Google Maps... if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"comgooglemaps://"]]) { [[UIApplication sharedApplication] openURL: [NSURL URLWithString:[NSString stringWithFormat:@"comgooglemaps://?q=%.6f,%.6f&center=%.6f,%.6f&zoom=15&views=traffic", [latitude doubleValue], [longitude doubleValue], [latitude doubleValue], [longitude doubleValue]]]]; } else { [[UIApplication sharedApplication] openURL: [NSURL URLWithString:[NSString stringWithFormat:@"https://maps.google.com/maps?&z=15&q=%.6f+%.6f&ll=%.6f+%.6f", [latitude doubleValue], [longitude doubleValue], [latitude doubleValue], [longitude doubleValue]]]]; } } } 

In this case, latitude and longitude are NSNumbers, but you can use regular double vars.

I hope this helps anyone;)

+4
source

Suddenly there is no way to display a marker using the URL scheme for Google Maps. You can simply pass a parameter to display directions from your current location. Here is a list with all supported parameters for the circuit.

0
source

Source: https://habr.com/ru/post/1208014/


All Articles