Cordova
We rely on NPM to distribute our Cordova SDK
Main dependency
cordova plugin add @purchasely/cordova-plugin-purchasely
Don't forget to change the minimum OS versions to match Purchasely requirements (iOS 11 / Android 21)
// Podfile
...
platform :ios, '11.0'
...
// Edit file android/build.gradle
buildscript {
ext {
minSdkVersion = 21 //min version must not be below 21
compileSdkVersion = 33
targetSdkVersion = 33
}
}
allprojects {
repositories {
mavenCentral()
}
}
Android setup
We do include a store by default in our SDK, with Android you can choose to use Google and/or Huawei and/or Amazon.
See below to add the store you want to use
Versioning
All your dependencies must always be at the same version for example
"dependencies": { "@purchasely/cordova-plugin-purchasely": "<<current_cordova_version>>", "@purchasely/cordova-plugin-purchasely-google": "<<current_cordova_version>>" },
Google Play Billing
To add Google as a store, you can use our NPM dependency
cordova plugin add @purchasely/cordova-plugin-purchasely-google
Then you must add Google in the list of stores
Purchasely.startWithAPIKey(
'<<X-API-KEY>>',
['Google'],
true, // true for StoreKit 1, false for StoreKit 2
null, // user id if user is conencted
Purchasely.LogLevel.DEBUG, // set to ERROR in production
Purchasely.RunningMode.full
);
Other stores
Our Cordova SDK does not contains other stores to avoid unnecessary integrations. You have to specifically declare which stores you want.
To add our stores dependencies to your project, you just need to add them to the app/build.gradle
file of your android folder in your project. The version must be the same than purchasely main dependency
dependencies {
//Amazon App Store
implementation 'io.purchasely:amazon:<<current_android_version>>'
//Huawei Mobile Services
implementation 'io.purchasely:huawei-services:<<current_android_version>>'
}
Updated 2 months ago