6

I've been looking for a way to capture the geolocation from a devices (iphone, ipad, etc) GPS and set the location value on a custom object. Looking to add an interactive google map or something to the object as well that works in conjunction with the captured location.

I'm having trouble finding a good resource that illustrates something like this. I've seen plenty of resources that use a defined location or address to make the interactive map but I'm looking for a way for the device to set that location on the fly.

Can anybody point me in the right direction?

6

Getting geolocaiton from mobile browser is easy if you are using a browser that supports it. Try below code,

navigator.geolocation.getCurrentPosition(GetLocation);
function GetLocation(location) {
    console.log(location);
}

Once you have got location to javascript, you can easily interact with salesforce API using javascript remoting or AJAX API. Try below link for query details, https://developer.salesforce.com/blogs/engineering/2015/02/geolocation-field-types-salesforce1-platform.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.