Skip to main content

A. Installation & Dependencies

This guide walks you through how to install the Entrupy Android SDK and its dependencies into your Android project, as well as the minimum supported Android versions and how to import and initialize the SDK.

1. Supported Android Versions

The Entrupy Android SDK supports:

  • Minimum SDK version: API 24 (Android 7.0 Nougat)
  • Target SDK version: API 35 (Android 15)
  • Java Version: 11

Ensure your project's build.gradle file is configured to use a minimum SDK of at least 24:

android {
compileSdk = 35

defaultConfig {
minSdk = 24
targetSdk = 35
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

2. Installation

The Entrupy Android SDK is distributed via GitHub Packages as a Maven repository. This method automatically handles all transitive dependencies.

📦 SDK Repository: The SDK is available at github.com/entrupy/entrupy-sdk-android. This repository contains the SDK package distributed via GitHub Packages for Maven-like integration.

💡 Sample Project: For a complete working example, see github.com/entrupy/entrupy-sdk-sampleproject-android. To see only the changes required for SDK integration, navigate to the "Entrupy SDK Integration" commit in the repository's Git history—this commit isolates the exact modifications needed to integrate the SDK into your own project.

2.1 Configure GitHub Packages Authentication

The SDK is hosted on GitHub Packages, which requires authentication. You can provide credentials via Gradle properties or environment variables.

Option A: Gradle Properties (Recommended)

Add your GitHub credentials to ~/.gradle/gradle.properties:

gpr.user=YOUR_GITHUB_USERNAME
gpr.token=YOUR_GITHUB_PERSONAL_ACCESS_TOKEN

Option B: Environment Variables

Alternatively, set environment variables:

export GITHUB_USER=YOUR_GITHUB_USERNAME
export GITHUB_TOKEN=YOUR_GITHUB_PERSONAL_ACCESS_TOKEN

📌 Note: Your GitHub Personal Access Token needs the read:packages scope. See How to Generate a GitHub Personal Access Token below.

2.2 Add the GitHub Packages Repository

Configure the Entrupy Maven repository in your settings.gradle.kts:

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()

// Entrupy SDK - GitHub Packages
maven {
url = uri("https://maven.pkg.github.com/entrupy/entrupy-sdk-android")
credentials {
username = providers.gradleProperty("gpr.user").orNull
?: providers.environmentVariable("GITHUB_USER").orNull ?: ""
password = providers.gradleProperty("gpr.token").orNull
?: providers.environmentVariable("GITHUB_TOKEN").orNull ?: ""
}
}
}
}

2.3 Add the SDK Dependency

Add the SDK dependency in your build.gradle.kts (app-level):

dependencies {
implementation("com.entrupy:sdk:1.0.0")
}

How to Generate a GitHub Personal Access Token

  1. Sign in to GitHub
    Go to github.com and log in to your account.

  2. Navigate to Token Settings

    • Click your profile picture in the top-right corner
    • Select Settings
    • Scroll down and click Developer settings in the left sidebar
    • Click Personal access tokensTokens (classic)
    • Or go directly to: https://github.com/settings/tokens
  3. Generate a New Token

    • Click Generate new tokenGenerate new token (classic)
    • You may be prompted to confirm your password
  4. Configure the Token

    • Note: Enter a descriptive name (e.g., "Entrupy SDK Access")
    • Expiration: Choose an expiration period
    • Scopes: Check the read:packages scope (under "write:packages")
  5. Create and Copy the Token

    • Click Generate token at the bottom
    • Important: Copy the token immediately—you won't be able to see it again
    • Store it securely in your ~/.gradle/gradle.properties file or as an environment variable

3. Required Permissions

Add the following permissions to your AndroidManifest.xml:

<uses-feature android:name="android.hardware.camera.any" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />

4. Importing the SDK

Once installed, import the SDK's main entry point into your Kotlin or Java code.

Kotlin:

import com.entrupy.sdk.app.EntrupyApp

Java:

import com.entrupy.sdk.app.EntrupyApp;

5. Initializing the SDK

The SDK must be initialized before any operations can be performed. Initialize it in your Application class's onCreate() method:

Kotlin:

import android.app.Application
import com.entrupy.sdk.app.EntrupyApp

class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
// Initialize SDK - MUST be called before any SDK operations
EntrupyApp.init(this)
}
}

Java:

import android.app.Application;
import com.entrupy.sdk.app.EntrupyApp;

public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Initialize SDK - MUST be called before any SDK operations
EntrupyApp.init(this);
}
}

⚠️ Important: Make sure your custom Application class is registered in your AndroidManifest.xml:

<application
android:name=".MyApplication"
...>

With the SDK installed and initialized, you are ready to proceed with app registration and requesting necessary permissions.