Start tracking geofence

Prev Next

This method allows you to start tracking the geofence of your users.

your title goes here
You need to have the required permissions to have the users' location information.

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

Android Geofence Details

According to the Google Play Policy for tracking geofence, app owners should have two different permissions.

First, app owners should get users' consent to collect their location. After users give consent or not, app owners need to update the value of the location opt-in on Insider accordingly. It has to be true to make geofence tracing work for a user. You can set up location opt-in accordingly from here.

To set up Insider location opt-in to true, Android's location consent should be allowed first.

Your title goes here
To track geofence, users should choose the "Always" and "Fine Location" options, other permissions do not work for Geofence.

To understand how to collect consent and what to do, please refer to Play Console-User Data.

Secondly, after collecting opt-in, we need to trigger the method below to track geofence. 

Method Signature

startTrackingGeofence(): void;

Method Example

window.Insider.startTrackingGeofence();