Configuration

After adding the SDK, you must configure your project to ensure it is properly set up before you begin using the SDK. This configuration process includes setting up necessary permissions, modifying project settings, and making any additional changes required by the SDK to work correctly on both iOS and Android platforms.

iOS Configuration

Project Settings

Follow the instructions below to complete the necessary configuration steps.

Configuring Capabilities

  1. Go to the Capabilities tab in your target settings.

  2. Under Background Modes, enable the following:

  • Location updates

  • Background fetch

  • Background processing

Once configured the settings page should resemble the image below:

Setting Up Background Tasks

The GIZO SDK requires the specification of a background task identifier to handle background work. Follow these steps:

  1. Go to Project settings and select your target.

  2. Navigate to the Info tab.

  3. Add Permitted background task scheduler identifiers if required.

  4. Under this, add the sub-item:

de.artificient.backgroundtask.task_process
de.artificient.backgroundtask.task_refresh

Permissions

Configure the required iOS permissions as specified in the table below:

  • LocationUsageDescription

  • LocationWhenInUseUsageDescription

  • LocationAlwaysUsageDescription

  • LocationAlwaysAndWhenInUseUsageDescription

  • MotionUsageDescription

Refer to the React Native permission acquisition guidelines for more information.

SDK License

Create a directory in the root of your project and add the license.json file to it. The file should follow the format shown below:

{
  "license": "<license key>"
}

Android Configuration

Permissions

Set up the required Android permissions as illustrated below:

  • ACCESS_FINE_LOCATION

  • ACCESS_COARSE_LOCATION

  • ACCESS_BACKGROUND_LOCATION

  • ACTIVITY_RECOGNITION

  • HIGH_SAMPLING_RATE_SENSORS

  • WRITE_EXTERNAL_STORAGE

  • READ_EXTERNAL_STORAGE

  • POST_NOTIFICATIONS

  • READ_PHONE_STATE

  • RECORD_AUDIO

The following items must also be configured:

  • AlarmScheduler

  • IgnoringBatteryOptimizations

  • UsageStats

The code snippet below must be added to Android Manifest file to specify the configurations, permissions, and metadata for an Android application.

?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />

    <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions"/>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <uses-permission  android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>

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

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
    <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />

    <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:name=".Application"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme"
        tools:targetApi="34" >

    </application>

</manifest>

SDK License

Navigate to the MainApplication.kt file in your Android project, locate the onCreate method, and add the GIZO SDK license as shown below:

override fun onCreate() {
    super.onCreate()
    SoLoader.init(this, false)
    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
      // If you opted-in for the New Architecture, we load the native entry point for this app.
      load()
    }
    ApplicationLifecycleDispatcher.onApplicationCreate(this)
    GizoSdkModule.initialize(context = this, license = "<license>")
}

Last updated