Install on Android
AFCore for Android is distributed as a Maven artifact published to GitHub Packages at AdvantaHealth/AFCore.
For full Gradle walkthroughs (Health Connect, Play Store manifests, etc.) see the legacy Android Setup page.
Quick add (Gradle)
settings.gradle.kts — add the GitHub Packages repository:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/AdvantaHealth/AFCore")
credentials {
username = providers.gradleProperty("gpr.user").orNull
?: System.getenv("GPR_USER")
password = providers.gradleProperty("gpr.key").orNull
?: System.getenv("GPR_KEY")
}
}
}
}
Your ~/.gradle/gradle.properties:
gpr.user=YOUR_GITHUB_USERNAME
gpr.key=YOUR_GITHUB_PAT # token with read:packages scope
Your app module's build.gradle.kts:
dependencies {
implementation("com.advantahealth:core-android:<latest-release>")
}
Find the latest version on the Releases page.
Minimum project setup
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
val config = AFCoreConfig.builder()
.baseUrl("https://api.example.com")
.clientId("…from AIDE…")
.clientSecret("…from AIDE…")
.enableLogging(BuildConfig.DEBUG)
.logLevel(AFLogLevel.DEBUG)
.build()
val success = AFCore.initialize(config)
if (!success) {
Log.e("AFCore", "Initialization failed")
}
}
}
Register the application class in your manifest:
<application
android:name=".MyApp"
…>
See Initialization for the full lifecycle.
Optional: AFCoreUI Compose components
If you also want the themed Compose component library, see UI Components → Compose. Currently only available via the source layout (:ui:afcore-ui-android Gradle module); a published artifact follows the next minor release.