Kotlin/Java

Our Android SDK has multiple dependencies according to your needs

Requirements

  • minSdkVersion: 23
  • compileSdkVersion: 36
  • Kotlin: 2.2.+
  • Gradle 8.+
  • Android Gradle Plugin: 8.+
  • 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:6.0.1'

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:6.0.1'
implementation 'io.purchasely:google-play:6.0.1'
implementation 'io.purchasely:player:6.0.1'

Google Play Billing - Only for Subscription Apps

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

implementation 'io.purchasely:google-play:6.0.1'

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:6.0.1'

If you already have your own player that support HLS video, you can also provide your own player view, more information in Displaying a video on Android

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:6.0.1'
}

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()))
  .runningMode(PLYRunningMode.Full)
  .build()
  .start { error ->
    if (error == null) {
      // Purchasely setup is complete 
      )
    }

Amazon App Store

You only need to add one dependency

implementation 'io.purchasely:amazon:6.0.1'

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()))
  .runningMode(PLYRunningMode.Full)
  .build()
  .start { error ->
    if (error == null) {
      // Purchasely setup is complete 
      )
    }

What’s Next

Did this page help you?