Locations & Geofences

The indigitall SDK can manage the user's location. This allows you to use the location filters on the send push campaign screen ( Campaigns> Push> New push campaign > Filters> Geographical Filters)

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

x

<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"/>

You can find the AndroidManifest.xml file in the following path:

Options to keep in mind
There are two ways to manage location permissions:

  • Manual: It is the default option and the developer is in charge of managing the location permissions.
  • Automatic: It is the SDK that manages the location permissions.

Here we explain how to configure location permissions in automatic mode.

The AutoRequestPermissionLocation parameter must be added when the SDK is initialized. This is done using the following code excerpt:

//When you want to initialize indigitall
Configuration config = new Configuration
    .Builder("<YOUR-APP-KEY>", "<YOUR-SENDER-ID>")
    .setAutoRequestPermissionLocation(true)
    .build();
Indigitall.init(context, config);

In Android there is a class where the status of the permissions is received after the user has changed them through the configuration. The following piece of code should be added to capture the status of the permissions:

//In the class you use to receive the results of asking for the permissions
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    Indigitall.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
}