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.

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 Application.kt file in your Android project, locate the onCreate method, and add the GIZO SDK license as shown below:

override fun onCreate() {
    super.onCreate()
    Gizo.initialize(
        this,
        GizoOptions.Builder(license = LICENSE)
        .build()
    )
}

Last updated