Emrah Akgül Emrah Akgül - 1 month ago 23
iOS Question

Add marker to google maps in ios using url scheme

When I tap on "Open in Google Maps" button in my application, I want my application to navigate to google maps application and open up the address that I specified and put a marker to it.

Here is my code for that purpose:

UIAlertAction* googleMaps = [UIAlertAction actionWithTitle:NSLocalizedString(@"google_maps", @"Google Maps") style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
NSString *customURL = @"comgooglemaps://?center=41.039400,28.994583&zoom=16&markers=size:mid%7Ccolor:0xff0000%7Clabel:1%7CVodafone+Arena+Stadyumu";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
}];


When I tap on the button, it correctly navigates to specific location. However, it does not put a marker to it. Is there a way to achieve this?

Thanks :)

Answer

As per the Google doc, the format specified in your code is wrong:-

Example:-

comgooglemaps://?q=Vodafone+Arena+Stadyumu&center=41.039400,28.994583&zoom=15&views=transit

This shows the marker in the center of the map