Examples

Install the module

Run the following command to install the module (make sure to install the core module beforehand):

npm i @sentiance-react-native/smart-geofences

Import the module

import SentianceSmartGeofences from "@sentiance-react-native/smart-geofences";

You can find a reference to all the types mentioned on this page here.

Refresh the list of monitored geofences

import {refreshGeofences} from "@sentiance-react-native/smart-geofences";

try {
     await refreshGeofences();
     console.log("Geofences refreshed successfully.");
} catch (error) {
     const refreshError = error.userInfo;
     const {reason, details} = refreshError;
     
     console.error("Refresh error reason:", reason);
     console.error("Refresh error details:", details);
}

Listen to smart geofence entry/exit events

Get the smart geofences detection mode