URL with Current Location to Google Maps from iPad fails - url

I am trying to create a URL that takes a user from where they are currently to any destination and provides directions. The URL below works fine in iOS on the iPhone, but does not on the iPad as it prompts be to clarify what Current Location is:
http://maps.google.com/maps?saddr=Current%20Location&daddr=350 Broadway,%20New%20York,%20New%20York
How can I make this work in both the iPhone and the iPad?

I've Research this but...
I have researched about this for a while, and I believe there is no way to specify Current Location. I know passing Current Location as a parameter on iPhone works, but it is recognized as string Current Location rather than what you are intended.
Alternative Way
The alternative way is to get the coordinate of the user using Core Location, and then pass this coordinate as saddr parameter.
It may be a bit ugly on Maps app because there will be an annotation that indicates the user's current location and another pin annotation that indicates the coordinate you passed.
How to Get the Current User Location
Here's a post for getting the user location.
What's the easiest way to get the current location of an iPhone?

It's actually very simple, the Google Maps API documentation says to simply leave saddr blank and that will cause it to use "Current Location" as the starting point for your Directions request.
Like this:
comgooglemaps://?saddr=&daddr=1600+Amphitheatre+Parkway,+Mountain+View,+CA+94043

Related

Swift : Can I use home and work locations using MapKit?

Everyone knows that Maps app can detect your home and work location and it shows you with "maps destination" feature. I am just wondering how it gets our specific location like work and home. Is it because we are stable on some places and it figures out we live here and we work there in specific time?
I'm also wondering that how can we get detected datas from the maps. Is it possible that I can use home and work locations on my app, using MapKit?
No you cannot, since it’s confidential users data. Only apples map app can use it

How can we start navigation in our own app Google Maps SDK iOS?

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.

Can Siri be invoked when opening iOS maps with directions?

From my iOS app I am invoking iOS maps with directions. Is it possible to also invoke Siri at the same time so voice directions can be given?
Here is the URL that I am currently using to invoke the maps:
http://maps.apple.com/?saddr={start lat},{start long}&daddr={dest lat},{dest long}
Is there something I can pass along in that querystring to have Siri start giving directions when the maps app opens? I can't seem to find anything that says I can (iOS Reference) but my users swear this worked at some point.
Thx.
Siri wont give directions till you are at the start point and the user presses "start".
so this will work:
http://maps.apple.com/?daddr=falkirk&dirflg=d&t=h
As it uses my current location as the start point, and falkirk is drivable to from my location. So setting the start and end point it wont work till you are at the start point.
e.g. this wont work for me as Im not in San Jose :(
http://maps.apple.com/?saddr=San+Jose&daddr=San+Francisco&dirflg=r

What google map and Apple map did to show MORE accurate location?

In my app, I am using CLLocationManager to get user's current location.
The problem is, most of the time, user would be indoor, or not very far from the building entrance when they launch my app for the very first time. As a result the location I get is not very accurate(more than 1km off).
Yet, at the same time, if I open either Google Map or Apple Map, they are able to display location with little discrepency(a few hundred meters). How they manage to do that ?

How to ask for user input for location or hardcode a lat/long pair, if users select "Dont Allow" in mkmapview?

(apologies if it seems like a rookie question but I work for a startup & given the stage where we are, I can use all the help to move things fwd .. thx guys!)
I am building a map based iOS app wherein its good to have user's location but not mandatory.
If the user selects "Don't Allow" for sharing his location, then I want to either have the map take him to a hardcoded lat/long pair OR I can show him dropdowns to pick his location but then it just does not drop the marker.
There has to be someway in which iOS app developers want to use maps but dont mandated detcting user's location .. How does one do that (if at all that's posible)?
Have a look at CLLocationManager class.. you can always check the Authorization status of the user loacation choice using + (CLAuthorizationStatus)authorizationStatus of CLLocationManager class.. Based on that you can decide your other actions like sending a hardcoded location value to someone or not.

Resources