3

Is it possible to get the turn by turn navigation using iOS Map Kit / Google Maps API or by launching iOS Maps /Google Maps with start and destination provided ?

Siva
  • 89
  • 2
  • 6

3 Answers3

3

The following code opens the native maps app with directions from the current location to a specified location. (Using Latitude & Longitude)

double latitude = **>>Your latitude<<**;
double longitude = **>>Your longitude<<**;



MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(latitude, longitude) addressDictionary:nil];

MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:placemark];
[mapItem setName:**>>Title of your desitnation<<**];

NSDictionary *options = @{
                          MKLaunchOptionsDirectionsModeKey:
                              MKLaunchOptionsDirectionsModeDriving,
                          MKLaunchOptionsMapTypeKey:
                              [NSNumber numberWithInteger:MKMapTypeStandard],
                          MKLaunchOptionsShowsTrafficKey:@NO
                          };

[mapItem openInMapsWithLaunchOptions:options];
Out of Orbit
  • 543
  • 2
  • 5
  • 17
  • i tried your code but in map it shows Directions not Available so where this code to put. – Bhavesh Nayi Oct 31 '15 at 09:29
  • This should work if **APPLE** map directions is supported in your country. Check here for availability: [iOS 9 Feature Availability](http://www.apple.com/ios/feature-availability/#maps-directions). If not supported check if you can use Google maps for directions – Out of Orbit Nov 03 '15 at 10:54
1

If you want it to happen within your app you have to obtain the directions list (http://www.techotopia.com/index.php/Using_MKDirections_to_get_iOS_7_Map_Directions_and_Routes) and implement the turn-by-turn directions process yourself .

I am sure that Google Maps SDK prohibits such use by its license terms. I think however that you can do it with MapKit. There also many other online routing services.

You can always simply redirect the user to the Maps app. It's very simple but the user gets away from your app. See here: Programmatically open Maps app in iOS 6

Community
  • 1
  • 1
Foti Dim
  • 1,303
  • 13
  • 19
1

If you're willing to also go the OpenStreetMap way, you can use the Scout SDK as it gives you the possibility of embedding turn-by-turn (audio & visual instructions) directly inside your app.

Ando
  • 11,199
  • 2
  • 30
  • 46
  • Is it possible to enable audio turn-by-turn instructions for directions on apple maps when opened from another app? Thanks in advance. – Ravi Kumar Dec 14 '18 at 07:29