Skip to main content

Geolocation & Geofencing

Geolocation & Geofencing

Use this component to fetch device's current location or geofencing.

To get started using it, you must use KmpGeolocation. All functions are thread safe and main thread safe.

Below are the functions available:


_3
KmpGeolocation.getCurrentLocation{
_3
val currentLocation = it // returns object storing user's latitude/longitude coordinates
_3
}

Android Setup

For android please add this into your manifest:


_2
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
_2
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

iOS Setup

Add the following into your device's info.plist file:


_5
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
_5
<string>Reason for why your app needs access to the device location</string>
_5
_5
<key>NSLocationWhenInUseUsageDescription</key>
_5
<string>Reason for why your app needs access to the device location</string>