coverY |
---|
0 |
The GPS settings in GIZO SDK allow developers to incorporate GPS functionality into their iOS applications. This documentation provides instructions on enabling GPS, accessing location, speed, direction of movement (heading), and speed limit.
GizoGpsSetting can be used to customize the behavior an app by adjusting its reading and saving parameters.
For this reason, add the following block of code in the Application class, onCreate function, inside Gizo.initialize to set the GizoGpsSetting.
Note: We need to get MAPBOX_PUBLIC_KEY from Mapbox.
{% tabs %} {% tab title="Swift" %}
let options: GizoAppOptions = GizoAppOptions()
options.gpsSetting.allowGps = true
options.gpsSetting.mapBoxKey = "MAPBOX_PUBLIC_KEY"
options.gpsSetting.interval = 1000
options.gpsSetting.maxWaitTime = 1000
options.gpsSetting.withForegroundService = false
options.gpsSetting.saveCsvFile = true
options.gpsSetting.fileLocation = FileLocationPath.Cache
options.gpsSetting.saveDataTimerPeriod = 10
{% endtab %} {% endtabs %}
The GizoGpsSetting sets the GPS-related properties such as
- allowGps(true): Enabling GPS.
- mapBoxKey("MAPBOX_PUBLIC_KEY"): Providing the Mapbox API key for accessing Mapbox services.
- interval(1000L): Default interval between location updates which updates to 1000 milliseconds (1 second) here.
- maxWaitTime(1000L): Sets the maximum wait time in milliseconds for location updates. Locations are determined at intervals but delivered in batch based on wait time. Batching is not supported by all engines.
- withForegroundService(true): If you set withForegroundService to true, you should only invoke this method when the app is in the foreground. withForegroundService - Boolean, if set to false, foreground service will not be started, no notifications will be rendered, and no location updates will be available while the app is in the background.
- saveCsvFile(true): Indicating that the GPS data should be saved to a CSV file.
- fileLocation(FileLocationPath.CACHE): Specifying the file location path for storing the GPS data CSV file (in this case, set to the cache directory).
- saveDataTimerPeriod(10L): Setting the period of saving GPS data to 10 milliseconds.
This code suggests that the GizoAppOptions class provides a way to specify various configuration options for the GIZO application, including GPS-related settings. The specific implementation and usage of GizoAppOptions would depend on the details of the GIZO application itself.
Here are the available options that can be set in gpsSetting in the Application class:
Options | Default Value | Description |
allowGps(Boolean) | false | To allow access to GPS setting. |
mapBoxKey(String) | _____ | The key was obtained from Mapbox. |
interval(Long) | 1000L | Default interval between location updates. |
maxWaitTime(Long) | 1000L | Sets the maximum wait time in milliseconds for location updates. Locations are determined at intervals but delivered in batch based on wait time. Batching is not supported by all engines. |
withForegroundService(Boolean) | true | If set to true, foreground service will be started, notifications will be rendered, and location updates will be available while the app is in the background. |
saveCsvFile(Boolean) | false | To save CSV file or not. |
fileLocation(FileLocationPath) | FileLocationPath.CACHE | To save GPS file, in the CACHE or DOWNLOAD. |
saveDataTimerPeriod(Long) | 10L | The period of time that a GPS data row is saved in CSV file. |