[SalesForce] Open Mapping app like Waze, Google Maps, and Apple Maps (iOS only) From Salesforce1

I have requirement :

Add a "Directions" button on the restaurant mobile page,"Directions" button should pass the restaurant's location to the device's selected mapping app.
Once this button is tapped, the user should be prompted to select their mapping app.

So Using VF page(Salesforce1) how can i open Mapping app like Waze, Google Maps, and Apple Maps (iOS only) etc ?

For Skype we can use "skype://call?415-555-1212" URL Scheme.
Regarding Mapping application what will be URL scheme i have need to use?

Thanks,

Raj

Best Answer

Solution:

1.) Waze Map:

var address = "{!Account.ShippingStreet}, " + "{!Account.ShippingCity}, " + "{!Account.ShippingPostalCode}, " + "{!Account.ShippingCountry}";

var encodedAddress = encodeURIComponent(address); sforce.one.navigateToURL("waze://?q="+encodedAddress +"&navigate=yes");

2.) Apple Maps (iOS only):

sforce.one.navigateToURL("maps://maps.apple.com/?saddr=My+Location&daddr="+encodedlatlong+"&directionsmode=driving");

3.) Google Maps :

if (mobileOperSys=="iOS")

sforce.one.navigateToURL("comgooglemaps://?saddr=My+Location&daddr="+encodedlatlong+"&directionsmode=driving");

else

sforce.one.navigateToURL("http://maps.google.com/?saddr=My+Location&daddr="+encodedlatlong+"&directionsmode=transit");

Related Topic