GuidesAPI ReferenceRelease Notes
HomeLog InHome
Guides

Getting started Android

This section provides a detailed guide on integrating the SDK into your Android project using Gradle, focusing on initialization with an API key. It includes step-by-step instructions on generating a GitHub Personal Access Token, storing token details securely, adding the GitHub repository to settings.gradle, and incorporating the SDK dependency into build.gradle.

Version requirements

SDK dependencies


def androidXCompat = "1.6.1"
implementation "androidx.appcompat:appcompat:$androidXCompat"
implementation "androidx.fragment:fragment-ktx:$androidXCompat"
implementation "androidx.activity:activity-ktx:$androidXCompat"

implementation 'com.google.android.material:material:1.9.0'
implementation "org.jetbrains.kotlin:kotlin-reflect:1.9.10"
implementation 'androidx.core:core-ktx:1.10.1'

//RoomDB
def room_version = "2.5.2"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
ksp "androidx.room:room-compiler:$room_version"

//Lifecycle
def lifecycleVersion = "2.6.2"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-process:$lifecycleVersion"

//Retrofit && OkHttp
def retrofitVersion = "2.9.0"
def okhttpVersion = "4.12.0"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"

// Coil
def coilVersion = "2.4.0"
implementation "io.coil-kt:coil-gif:$coilVersion"
implementation("io.coil-kt:coil:$coilVersion")

// Glide
def glideVersion = "4.16.0"
implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation "com.github.bumptech.glide:okhttp3-integration:$glideVersion"
annotationProcessor "com.github.bumptech.glide:compiler:$glideVersion"

//ExoPlayer
def ExoPlayerVersion = "1.5.1"
implementation "androidx.media3:media3-exoplayer:$ExoPlayerVersion"
implementation "androidx.media3:media3-ui:$ExoPlayerVersion"
implementation "androidx.media3:media3-exoplayer-workmanager:$ExoPlayerVersion"
implementation "androidx.media3:media3-exoplayer-hls:$ExoPlayerVersion"

def constraintLayoutVersion = "2.2.1"
implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"

//Compose
implementation "androidx.compose.ui:ui:1.4.3"
implementation "androidx.compose.ui:ui-tooling-preview:1.4.3"
implementation "androidx.compose.material3:material3:1.1.2"
implementation 'androidx.constraintlayout:constraintlayout-compose:1.0.1'
implementation 'androidx.lifecycle:lifecycle-runtime-compose:2.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1'
implementation 'androidx.activity:activity-compose:1.7.2'
implementation 'androidx.navigation:navigation-compose:2.6.0'

// Android Startup (Content Provider) lib
def androidStartupVersion = "1.8.0"
implementation "androidx.startup:startup-runtime:$androidStartupVersion"

Using our Android library from GitHub Packages

Currently the GitHub Packages requires us to Authenticate to download an Android Library (Public or Private) hosted on the GitHub Package. This might change for future releases.

Step 1: Generate a personal access token for GitHub

Login to your GitHub account:

Under Settings -> Developer Settings -> Personal Access Tokens -> Generate new token

Make sure you select the following scopes (“read:packages”) and Generate a token. After Generating make sure to copy your new personal access token. You cannot view it again! The only option is to generate a new key.

You can read more on Github personal Access token instructions

Step 2: store your GitHub personal access token details

Within your root Android project, you can find the gradle.properties file

📘

make sure you add this file to .gitignore, keeping the token private

Add the following properties

gprUsr=GITHUB_USERID
gprKey=PERSONAL_ACCESS_TOKEN
  • Replace GITHUB_USERID with personal / organization Github User ID
  • Replace PERSONAL_ACCESS_TOKEN with the token generated in #Step 1

Alternatively, you can also add the properties and values to your environment variables on your local machine or build server to avoid adding them to the gradle.properties file.

Step 3: add github repo to settings.gradle

Within your root Android project you can find the settings.gradle file.
It might look something similar.

pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}


dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            name = "WSCGithubPackage"
            url = uri("https://maven.pkg.github.com/WSCSports/blaze-android-release")
            credentials {
                /** you can add to gradle.properties the following keys
                 ** gprUsr=GITHUB_USER_ID & gprKey=PERSONAL_ACCESS_TOKEN
                 * GITHUB_USER_ID is your github user
                 * PERSONAL_ACCESS_TOKEN is your github personal token
                 **/

                username = "$gprUsr"
                password = "$gprKey"
            }
        }
    }
}

rootProject.name = "BlazeSDK-Android-SampleApp"
include ':app'

As you can see we added a new maven repository for WSCGithubPackage.
Sample app has the same setup

Step 4 : Adding dependency into build.gradle

In your build.gradle file you should add the proper dependency

//WSC BLAZE SDK 
def blazeSDK = '<VERSION>'

implementation group: "com.blaze", name: "blazesdk", version: "${blazeSDK}"

// If you're using IMA:
implementation group: "com.blaze", name: "ima", version: "${blazeSDK}"

// If you're using GAM:
implementation group: "com.blaze", name: "gam", version: "${blazeSDK}"
  • Replace <VERSION> with the latest version

The sample app is using the same setup Sample app build.gradle


Did this page help you?