LogoLogo
  • Welcome!
  • MOBILE SDK
    • iOS
      • SnapOdds Operator
        • Installation
        • Initialization
        • Snapping Games
        • Customization
        • API documentation
      • SnapOdds Sport Media
        • Installation
        • Initialization
        • Snapping Games and Presenting Odds
        • Customization
        • API documentation
    • Android
      • SnapOdds Operator
        • Installation
        • Initialization
        • Permissions
        • Snapping Games
        • Customization
        • API documentation
      • SnapOdds Sport Media
        • Installation
        • Initialization
        • Permissions
        • Snapping Games and Presenting Odds
        • Customization
        • API documentation
    • React Native
      • iOS Installation
      • Android Installation
      • SnapOdds Operator
        • Initialization
        • Snapping Games
        • Customization
      • SnapOdds Sport Media
        • Initialization
        • Snapping Games and Presenting Odds
        • Customization
  • Web SDK
    • JavaScript
      • SnapOdds Operator
        • Installation
        • Access Token Handling
        • Snapping Games
        • Customization
        • API documentation
      • SnapOdds Sport Media
        • Installation
        • Access Token Handling
        • Snapping Games and Presenting Odds
        • Customization
        • API documentation
      • Implementation Errors
  • Integration Guide
    • SnapOdds as Button
    • SnapOdds as Banner
Powered by GitBook
On this page
  • Github Packages
  • Create a Personal Access Token on Github
  • Configure your Github Personal Access Token
  • Add Github Packages Repository to Application Module's build.gradle
  • Add Dependency to Snapscreen SDK in Application Module's build.gradle

Was this helpful?

Export as PDF
  1. MOBILE SDK
  2. Android
  3. SnapOdds Sport Media

Installation

Installing the Android SDK.

Github Packages

Create a Personal Access Token on Github

Inside your GitHub Account:

  1. Go to Settings -> Developer Settings -> Personal Access Tokens -> Generate new token

  2. Make sure to select the scope read:packages and Generate a token

  3. After the token is generated, be sure to copy your new personal access token. It will not be accessible again. If the key is lost, the only option is to generate a new key.

Configure your Github Personal Access Token

To configure your token, a github.properties file containing your Github User ID and Personal Access Token must be placed in your project's root directory as shown below:

gpr.user=GITHUB_USERID
gpr.key=PERSONAL_ACCESS_TOKEN

Alternatively, you can set the environment variables GPR_USER and GPR_API_KEY.

Add Github Packages Repository to Application Module's build.gradle

Next, define the Github Packages as a repository in the application module's build.gradle by adding the following section:

def githubProperties = new Properties() githubProperties.load(new FileInputStream(rootProject.file("github.properties")))
repositories {
    maven {
        name = "GitHubPackages"
        url = uri("https://maven.pkg.github.com/snapodds/sdk-android")
        
        credentials {        
            /** Create github.properties in root project folder file with     
            ** gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN 
            ** Or set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/
            username = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER")
            password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY")
        }

        metadataSources {
            mavenPom()
            google()
            mavenCentral()
            artifact()
        }
    }
}

Add Dependency to Snapscreen SDK in Application Module's build.gradle

dependencies {
    //consume library
    implementation 'com.snapscreen.mobile:sdk-android:latest-release'
}

Note: If you have configured the project repositories via settings.gradle and changed the dependencyResolutionManagement to settings such as FAIL_ON_PROJECT_REPOS this may necessitate a change in where the repository is defined.

PreviousSnapOdds Sport MediaNextInitialization

Last updated 3 years ago

Was this helpful?