Is there any way to request the list of directions for the active destination in iOS (Maps or Google Maps). I see a reference to "Routing App" but I cannot find any documentation on it.
Basically, I would like to retrieve a the next navigation step so I can forward that to my Bluetooth device and show it to the end user, similar to how FitBit and WatchOS do it.
Many ways to do this.
Since you asked for MapKit, have a look at
MKDirections https://developer.apple.com/documentation/mapkit/mkdirections
In the result you should find steps: https://developer.apple.com/documentation/mapkit/mkroute/step
These steps should be what you're looking for.
Related
How can we start navigation between two routes when taken from the Google Directions API.
Any ideas where to go from here? How can I manage to integrate the navigation from one route to another in our own App?
I am getting the routes from the google directions API and it is being shown in my App. But how can I start the navigation between them using my current location not using google map app but in our own app?
Well, you're asking a board question which doesn't have code in it indicating what you have done so far, so, assuming you want to know what steps you have to do, here is the answer:
if you have gotten the destination coordinates, longitude & latitude, you can pass them to your instance of the MapKit, and you got the destination.
The starting point, which in this case is the user's location can be asked from the user by accessing it in by adding Privacy - Location Always Usage in your info.plist file.
Then you can start routing between the Two locations.
I highly encourage you to read more on Apple's CLLocation framework which lays the outline of this with extra details.
We have an app that allows users to check-out and ride a certain type of vehicle, and I want to build a button that, when pressed, redirects them to their default navigation app, optionally with a destination pre-selected. Crucially, this vehicle is not allowed on highways, so we do not ever want to direct users to a route with highways in it.
Right now, I am stuck because it looks like I cannot launch Apple Maps with "avoid highways" selected. I am using the URL "http://maps.apple.com/daddr=0,0&dirflg=h", but &dirflg=h did not work for me, neither did &avoid=highways or &avoid=h. Looking at Apple's documentations, it appears that this param just isn't available: https://developer.apple.com/library/content/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
It looks like for iOS users I would have to redirect them to use Google Maps instead, which I can do according to the Google Maps iOS SDK docs: https://developers.google.com/maps/documentation/ios-sdk/urlscheme. Is that true? Is there really no way to open Apple Maps with 'avoid highways' selected?
Yep—from that documentation it looks like there’s indeed no flag for that setting in the request URL. You may want to file an enhancement request on MapKit for that feature.
I am looking for a way to get or make turn by turn navigation using Google Maps Api in swift. I've done drawing polylines from source to destination using GoogleMaps Api but still couldn't find a way to do turn by turn navigation. Is it possible?
-Thanks
Yes. It is possible.
Please refer following link which is using turn by turn directions using google API.
https://itunes.apple.com/us/app/biznavi-gets-you-where-you/id597147565?mt=8
(see last two screen shot of iPad from itunes link)
To achieve it, you have to use Google Direction API which allows us to use upto 8 way points.
After that you will get an array of route including all turn by turn message and lat/long.
Just create a CLRegion of 100 meters (or as per your requirement.) around your current location in locationDidUpdate method. If next point of route array falls within CLRegion, just show a message received in routes array by google API.
I have made above application but it was not updated after uploading to store so it is having old UI and it is not having iPhone 5+ support. Sorry for that but you will find feature you require in this app...
I am building an application that must take user's input of a start location, and two destinations and show the route between the three. I have used google maps api in my project to add a map view, but the google directions API is not meant for user input. Should I use the google maps javascript API or add a web view. How would I go about using either?
Google Maps Javascript API: https://developers.google.com/maps/documentation/javascript/directions#Directions
What about the option of having the user launch either google maps or maps with the direction? To do that there's a pretty good answer here: How to Open Google Map Navigation Url with Direction and Voice in iOS?
Multitasking on the phone is pretty good these days so it shouldn't cause too much user annoyance to have another app (built to directions) take over that job. The only reason I'd see to not do it that way is if your app is something like Uber, but if that's the case then there's a few other things you could do.
I have been searching all around about how to integrate driving directions into MKMapView within my application. Is the only way to open the Apple Maps program and go from there, or is their a way of integrating within your own app. If not, I will probably go with google maps as soon as I can get an API key.
If you mean getting the same views for driving direction (a.k.a. turn-by-turn navigation) as the Apple Maps application, then no... as far as I know, there is no library for that (if not 3rd party).
However, as you mentioned, you can open apple maps or google maps giving the directions to the application and initiate such a function.
Also, good to know: If there would be such a build-in functionality in iOS6 (which, again I don't believe there is) its good to know it doesn't exist in pre-iOS6. Meaning it won't work on earlier devices. (hence you need to build a fall-back solution if you want to support those devices as well).
More information on iOS turn-by-turn: http://developer.apple.com/library/ios/#releasenotes/General/WhatsNewIniPhoneOS/Articles/iOS6.html
Quote from that page (which makes me believe turn-by-turn is not supported in the API's):
... Apps that offer routing information, such as turn-by-turn navigation services, can now register as a routing app and make those services available to the entire system.
The documentation search page doesn't give much more info either: http://developer.apple.com/library/ios/search/?q=turn-by-turn
For more information on how to open the maps app, check the answer here: https://stackoverflow.com/a/12789896/406677
So bottom line, you need to either create your own turn-by-turn navigation... or link to an existing application giving such support.
I hope that answered your question.