GeolocationService service
Level: beginner
GeolocationService service returns current location using the getCurrentCoordinates() method. Learn more: Work with GPS data in Creatio Mobile.
Retrieve the current geographic coordinates.
Input parameters
GeolocationAccuracy | Accuracy to retrieve the coordinates. The time needed to determine the coordinates depends on specified accuracy. Accuracy depends on the following factors:
- Environmental factors. Buildings, trees, and other obstructions can affect signal strength and accuracy.
- Device quality. Modern mobile devices generally have more advanced location capabilities than older mobile devices.
- Used technology. GPS is typically more accurate (5-10 meters) than cellular data (100-1000 meters).
Available valueslowest | On Android: approximately 500 meters.
On iOS: approximately 3000 meters. | low | On Android: approximately 500 meters.
On iOS: approximately 1000 meters. | medium | On Android: approximately 100-500 meters.
On iOS: approximately 100 meters. | high | On Android: approximately 0-100 meters.
On iOS: approximately 10 meters. | best | On Android: approximately 0-100 meters.
On iOS: approximately 0 meters. | bestForNavigation | On Android: approximately 0-100 meters.
On iOS: optimized for navigation. | reduced | On Android: not applicable.
On iOS 14 and later: approximately 3000 meters. |
|
Output parameters
latitude* | Latitude, in degrees. If the latitude is undefined, return "0." |
longitude* | Longitude, in degrees. If the longitude is undefined, return "0." |
errorCode | Error code.Available valuesserviceDisabled | The GeolocationService service is disabled. | permissionDenied | Access to the GeolocationService service is limited by user permissions. | permissionDeniedForever | Access to the GeolocationService service is denied permanently. The Creatio Mobile does not request access again until the user enables it manually in the mobile device settings. | timeout | Operation timeout has passed. | unknown | For other unexpected cases. |
|
errorMessage | Error message. |
accuracy | Accuracy, in meters. |
isMocked | The flag that specifies whether the location is provided by mocked provider. Android only.Available valuestrue | The location is provided by mocked provider. | false | The location is not provided by mocked provider. |
|