Locations & Geofences

In this section you will find a series of more advanced functionalities that require a more complex development. We recommend that a developer be in charge of this configuration.

Activate Geolocated Notifications

1699

Once we have enabled this functionality, the end user will have to consent to the location permission and enable location services, so that the application obtains the exact location of the user.

In order to use the localization functionality through the SDK of indigitall it is necessary to add the requestLoation method to the initial configuration.

You can check the code snippet below.

<script
  src="/en/indigitall/sdk.min.js"
  onload="indigitall.init({
    ...
    requestLocation: true
    ...
  })"
  async>
</script>

Options to keep in mind
It is necessary to be aware of the user's location changes in order to save them in the indigitall tool.

To verify if the device has changed its location, the onLocationUpdated callback must be added to the initial configuration in order to listen for these location changes in that method.

You can check the code extract below.

<script>
  function onLocationUpdated(location){
    console.log("Location\n \t - Latitude:"+location.coords.latitude+"\n \t - Longitude: "+ location.coords.longitude);
  }
</script>

<script
  src="/en/indigitall/sdk.min.js"
  onload="indigitall.init({
    ...
    onLocationUpdated: onLocationUpdated
    ...
  })"
  async>
</script>