Is there any way via the public API to get the current route that is being used in Apple Maps?
That is, a user is currently navigating a route via Apple Maps and switches to my app. Is there any way for me to know the route currently in use? Or at least, the current destination?
As far as I know, you can only pass data to the maps app. It does not work the other way, so I don't believe you could retrieve information about the current route.
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 have to retrieve the Apple Maps navigation history. In other words, is there a way of retrieving the recent routes searched by the user of the Apple Maps app? I need recent searches in HomeKit app(in iOS 10).
There is no API available to get information out of the Navigation App. But you can feed some data to Maps to request a route through an Intent / URI.
But I don't think that the Maps app will save the whole route anyway, only the destination. The user selects any saved destination and you can get there from any source.
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.