Kotlin/Java

Our Android SDK has multiple dependencies according to your needs

Requirements

  • minSdkVersion: 21
  • compileSdkVersion: 33
  • Kotlin: 1.8.+
  • Gradle 7.+
  • Android Gradle Plugin: 4.+
  • JDK 11

We rely on Maven to distribute our Android so make sure you are fetching your dependencies from Maven Central

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

📘

Android TV

Our SDK is compatible with Android TV and thus declare in its manifest:
<uses-feature android:name="android.software.leanback" android:required="false" />

<uses-feature android:name="android.hardware.touchscreen" android:required="false" />

Core dependency

This is the main and required dependency to make Purchasely work

implementation 'io.purchasely:core:<<current_major_version>>.+'

This dependency contains everything you need to make purchasely run except the store and player

📘

Versioning

All your dependencies must always be at the same version for example if you specify one

implementation 'io.purchasely:core:<<current_android_version>>'
implementation 'io.purchasely:google-play:<<current_android_version>>'
implementation 'io.purchasely:player:<<current_android_version>>'

Google Play Billing

Our SDK integrates Google Play Billing Client version 6.2.1, you must not use another dependency with an older version in your project.

implementation 'io.purchasely:google-play:<<current_major_version>>.+'

This dependency contains the class GoogleStore that you must add to Purchasely.Builder to be used by the SDK

Video Player

If you have videos in your paywall, you must provide a video player to play them.
Purchasely core dependency does not include a video player to avoid dependency conflicts, specifically with Media3 Exoplayer

We do provide a player dependency which will be detected automatically by our SDK if you do not have a video player in your application
implementation 'io.purchasely:player:<<current_major_version>>.+'

If you already have your own player that support HLS video, you can also provide your own player view, more information here

Huawei Mobile Services

Huawei requires you to provide the SHA-1 of your certificate and add their configuration file to your project (agconnect-services.json). Please refer to their documentation : https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/config-agc-0000001050033072-V5

To integrate Huawei Mobile Services, you need to add dependencies to huawei repository and plug-in as referred in their documentation : https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/integrating-sdk-0000001050035023-V5

// Edit file android/build.gradle
buildscript {
    repositories {
        maven {url 'https://developer.huawei.com/repo/'}
    }
    dependencies {
        classpath 'com.huawei.agconnect:agcp:1.6.0.300'
    }
}

allprojects {
    repositories {
        //Huawei only
        maven {url 'https://developer.huawei.com/repo/'}
    }
}

Finally you can Purchasely Huawei dependency

//Add this line after android plugin
apply plugin: 'com.huawei.agconnect'

dependencies {
    //Add this line to integrate Huawei Mobile Services with Purchasely
    implementation 'io.purchasely:huawei-services:<<current_major_version>>.+'
}

This dependency contains the class GoogleStore that you must add to Purchasely.Builder to be used by the SDK

Purchasely.Builder(applicationContext)
  .apiKey("<<X-API-KEY>>")
  .stores(listOf(HuaweiStore()))
  .build()
  .start { isConfigured, error ->
    if(isConfigured) {
      // Purchasely setup is complete 
      )
    }

Amazon App Store

You only need to add one dependency

implementation 'io.purchasely:amazon:<<current_major_version>>.+'

This dependency contains the class AmazonStore that you must add to Purchasely.Builder to be used by the SDK

Purchasely.Builder(applicationContext)
  .apiKey("<<X-API-KEY>>")
  .stores(listOf(AmazonStore()))
  .build()
  .start { isConfigured, error ->
    if(isConfigured) {
      // Purchasely setup is complete 
      )
    }

What’s Next