Skip to content

Integration of the IOMB Lib Android

The integration of the IOMb Library Android is done in a few steps via Maven:

Prerequisites

The IOMb Library is provided via GitHub Packages. To access it, you need a GitHub Classic Personal Access Token with the read:packages scope.

Classic Token Required

Fine-grained Personal Access Tokens are currently not supported by GitHub Packages for Maven. Use a Classic token.

  1. Create a Classic Personal Access Token at: https://github.com/settings/tokens/new
  2. Select at least the read:packages scope
  3. Store the token securely

Configuration

~/.gradle/gradle.properties (recommended):

1
2
gpr.user=YOUR_GITHUB_USERNAME
gpr.token=YOUR_GITHUB_TOKEN

Note

The file ~/.gradle/gradle.properties may not exist yet and might need to be created first.

Alternatively, you can store the credentials in the project-specific gradle.properties in the project directory.

Security Notice for project-specific gradle.properties

Never commit your gradle.properties with real credentials to a repository. Add the file to .gitignore or use environment variables.

Add Repository

Depending on your project structure, there are two ways to add the GitHub Packages repository:

Open build.gradle.kts in the project root and add the repository under allprojects > repositories:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
allprojects {
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://maven.pkg.github.com/INFOnline-sg/libs-appsensor-iomb-android")
            name = "GitHubPackages"
            credentials {
                username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_USERNAME")
                password = project.findProperty("gpr.token") as String? ?: System.getenv("GITHUB_TOKEN")
            }
        }
    }
}

For newer projects using dependencyResolutionManagement, add the repository in settings.gradle.kts:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://maven.pkg.github.com/INFOnline-sg/libs-appsensor-iomb-android")
            name = "GitHubPackages"
            credentials {
                username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_USERNAME")
                password = providers.gradleProperty("gpr.token").orNull ?: System.getenv("GITHUB_TOKEN")
            }
        }
    }
}

Which Variant?

  • settings.gradle.kts: Recommended for new projects (Android Studio Flamingo+). Uses providers.gradleProperty().
  • build.gradle.kts: For existing projects without dependencyResolutionManagement. Uses project.findProperty().

Add Dependency

Under "dependencies" in the build.gradle.kts of the app module, reference the IOMb Library:

1
2
3
4
dependencies {
    implementation("de.infonline:iomb-library:1.1.2") // adjust version number for updates
    ...
}

Last update: January 27, 2026