Reputation: 21
I can open Google maps app using [NSURL URLWithString:@"comgooglemaps://...."]
But how to open Navigation mode?
Upvotes: 0
Views: 1238
Reputation: 36
The navigation mode is explained here, "Add navigation to your app" : https://developers.google.com/maps/documentation/ios-sdk/urlscheme
Try this code :
NSURL *testURL = [NSURL URLWithString:@"comgooglemaps-x-callback://"];
if ([[UIApplication sharedApplication] canOpenURL:testURL]) {
NSString *directionsRequest = @"comgooglemaps-x-callback://" + @"?daddr=John+F.+Kennedy+International+Airport,+Van+Wyck+Expressway,+Jamaica,+New+York" + @"&x-success=sourceapp://?resume=true&x-source=AirApp";
NSURL *directionsURL = [NSURL URLWithString:directionsRequest];
[[UIApplication sharedApplication] openURL:directionsURL];
}
Upvotes: 1