Android
The Thryve Android SDK is the fastest way to implement Thryve's product into your Android application and is required to allow users to connect Health Connect and Samsung Health as a data source. The Thryve iOS SDK is available via the Maven repository and frameworks.
Integrate using Thryve Repository Dependencies
Thryve provides a private, protected repository supporting the Maven repository format to retrieve the Thryve SDK build artifacts. To configure a Gradle project to resolve dependencies declared in build.gradle file, the Thryve repository has to be declared as shown in the root and app build.gradle files.
The Root build.gradle file
allprojects {
repositories {
...
maven {
url = uri("https://nexus.external.thryve.de/repository/releases/")
credentials {
username = thryveUsername
password = thryvePassword
}
}
// Optional, required only for Garmin Companion integration.
maven {
url = uri("https://maven.pkg.github.com/garmin-health-sdk/android-sdk")
credentials {
username = garminGithubUsername
password = garminGithubToken
}
}
...
}
}Your username and password are provided in onboarding when signing up with Thryve. Your garminGithubUsername and garminGithubToken are provided on request via Thryve customer support.
It is recommended to store credentials in your project’s local.properties or the user-global Gradle properties gradle.properties
The App build.gradle file
Add dependencies to the app build.gradle after adding the repository
Integrate using Thryve .aar Libraries
The Thryve Android SDK module is available as a standard Android Archive (aar). You can download the framework files here:
Integrating AAR Libraries into Your Application
Add AAR File:
Place the
.aarfile in a project directory, such aslibs.
Update
build.gradle:Add
implementation files('libs/.aar').
Enable Kotlin Support:
Include annotation processing.
Add Android Support Libraries:
Integrate the
Android AppCompat-Library.
Set Java Compatibility:
Ensure target and source compatibility for Java 1.8.
Set Kotlin JVM Target:
Use Kotlin JVM target version 1.8.
Ensure you include the necessary dependencies for the Thryve SDK and verify that they are all compatible versions.
Configure dependency versions
Keeping your dependency versions aligned with the supported versions of the Thryve Android SDK is crucial for ensuring compatibility and maintaining the stability of your application.
Outdated or mismatched versions can lead to integration issues, such as runtime errors or unexpected behavior, which may hinder app performance and user experience.
Custom WorkManager configuration
Thryve Android SDK relies on Android WorkManager for scheduled background task. To provide a custom implementation and rules for background tasks and overwrite Thryve SDK defaulty, implement Configuration.Provider and use WorkManagerInitializer in your Application class. See the Kotlin code example below for guidance. The code snippet changes the minimum logging level for your app, but the implementation can be further customized to your apps needs.
Health Connect project configuration
To integrate Health Connect with your Android app, utilize the ThryveHealthConnect module from the Thryve Android SDK. This module enables users to connect with Health Connect on their smartphones and allows your app to retrieve evaluated and aggregated data from various sources linked to Health Connect. You can integrate it by using Thryve Maven Repository Dependency or AAR Libraries and updating your app's build.gradle file accordingly.
Declare Health Connect permissions
To utilize Health Connect, your application must declare all necessary permissions and provide a privacy policy activity for handling the ACTION_SHOW_PERMISSIONS_RATIONALE intent within the AndroidManifest. Pay attention to the differences in declarations for Android 14 versus older versions.
Ensure that the declared policies align with the data types set in ThryveHealthConnectConfig. Also, remember to declare permissions for background sync and health data history when enabling these features.
Samsung Health project configuration
You must suppress warnings after adding the ThryveSamsungHealth module, include -dontwarn com.samsung.** in your proguard-rules file.
Last updated

