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.
Related
Is there a URL to open the contacts application from within my application? I know you can achieve this with the settings app by using the UIApplicationOpenSettingsURLString constant in Swift; however, I wasn't sure if I could do the same with the Contacts app.
There isn't a deep link for opening the Contacts App.
Apple is very picky when it comes to deep-linking. They have to provide one for Settings since many apps need services like Data, Location, Bluetooth, Wifi, etc.
Unfortunately they do not extend this to the Contacts App.
However if your app needs contact information then for that Apple has provided a Contacts framework to browse through your contacts within your app itself.
Read more about it here.
In order to add/update/delete/merge contacts directly from your app without using the Apple's Contact UI, use the CNSaveRequest APIs. More on that here.
The closest thing you can get to opening a contact is to write them a message in IMessage. From this screen the user can press the contact icon and open the contact page for that particular contact.
You can do this by opening the url sms://+44776382223 where the number is the number of the person that you would like to view the contact of.
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...
Hey Guys I was wondering if there is a way to redirect the user back to my iOS app after they've reached their destination on Apple maps or Google maps. Thanks!
This could be possible if the app you open, is yours as well, then you could add some code there that does that. However, if you are talking about google maps / Apple maps, then that is not the case.
As far as I know, there is no api for that... iOS 9 brought the "back to..." button exactly for these situations which gives the user an easier way of switching back to the opening app.
Question, why to open another app if maps is all you need? You can always implement a map in your app and save the switching...
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.