Capturing the user's location

Mobile devices, by their very nature, are used on the move and applications often need to capture the location of the user in order to provide the best user experience; for example, showing proximity to a business or services, or allowing users to check-in at a destination.

In this recipe, we will create a mobile Visualforce page to capture a lead and the location of the user at the point of lead creation. The location will be stored on the lead record in the Salesforce database in a custom geolocation field.

Getting ready

This recipe requires that you have already uploaded the Salesforce Lightning Design System version 2.0.2 as detailed in Chapter 8, Force.com Sites.

This recipe also requires a custom field on the lead ...

Get Visualforce Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.