The GPS Tutorial App shows how to set up an app to use GPS.
It gets a GPS fix then display the device location on a map.
How the App Works
To start GPS in an app you need to set 'Enable GPS Update'.
That feature is available in the EDIT VIEW, under the GENERAL tab.
For this app we set it for the view 'Locate Me' (Everything regarding the Location is done at that view level)
Once the view from which 'Uses GPS Update' is called the app will automatically ask the user if it is authorized it to use location services.
If the user says yes it will get a GPS Fix.
We use 2 Events to manager the result:
- Location Update Success
- Location Update Failure
These Events are configured in the EVENT tab available through the Edit of the View Related Actions.
Event Tab is the one accessible through 'Edit' under 'View Related Actions'
NOT the Edit for the 'App Related Actions'
Once in the Edit of View Related Actions
Select the 'Location' segment
1. 'Location Update Success': Where we update a container displaying the Long / Lat.
2. 'Location Update Failure': The device couldn't get a fix, we communicate to the user that GPS isn't available.
If the Location Update is a success we also update the Container 'Display on Map - Container' to turn the Button to Active so user can elect to see the device location on the Map.
- How to use the Map Block
- Use System Value: Device Latitude and Device Longitude