Android

Battery Optimization work arounds

The Android SDK does as much as it can in ways of permissions, workers, and other methods in order to either keep an app alive or have the ability for the app to wake up. Even with the efforts of our SDK, each Android device manufacture has its own implementation of battery optimization which can override the Android OS's measures. This leads to inconsistent behaviour across Android device manufactures. Please see the website Don't kill my app! for further information and workarounds.

Problematic Devices

  • Samsung

  • OnePlus

  • Huawei

  • Xiaomi

Fixing Runtime Crashes

Depending on your configuration you may need to add additional dependencies to the app's build file to prevent runtime crashes. The most common ones are:

dependencies {
    ...
    implementation 'androidx.work:work-runtime-ktx:2.7.0' 
    implementation 'dnsjava:dnsjava:3.4.1'
    implementation 'com.google.android.gms:play-services-location:19.0.1'
    implementation 'androidx.datastore:datastore-preferences:1.0.0'
    implementation 'com.squareup.moshi:moshi-kotlin:1.12.0'
    implementation 'no.nordicsemi.android.support.v18:scanner:1.6.0'
    implementation 'com.google.code.gson:gson:2.8.8'
    ...
}

Huawei (No Google Services)

For newer Huawei devices that have been bought in China, some of these devices no longer use the Android OS which means they also do not have Google Play Services. Google Play services is required for the SDK in order to receive GPS data and Activity data. The IMS SDK will not work with these devices.

This does not apply for Huawei devices that have been purchased outside of China.

Importing repository

Because the repository is protected you need to add your credentials to the build.gradle file:

maven {
    url 'https://maven.pkg.github.com/ims-developers/android-sdk'
    name 'GitHubPackages'
    credentials {
        username System.getenv("GITHUB_MAVEN_USERNAME")
        password System.getenv("GITHUB_MAVEN_PAT")
    }
}

Last updated