Integrate the Entitlements SDK
Integrate the Entitlements SDK into your application
Prerequisites
Get Started
Integrate the iOS SDK
To use Entitlements SDK in an iOS app, you need to install the SudoEntitlements package via Swift Package Manager
Open your project settings in XCode, and go to the Package Dependencies
tab. Click on the +
sign to add a dependency.
Enter the repository URL https://github.com/sudoplatform/sudo-entitlements-ios
in the top right search box and select the sudo-entitlements-ios
repository.
Select the required version and Add Package
.
Sudo Platform SDKs conform to semantic versioning so in most cases you will leave the Dependency Rule as Up to Next Major Version
to receive regular updates without introducing any breaking changes.
This will resolve the local package dependency and install the latest version of the Entitlements SDK.
Client Initialization
To instantiate a client in your application, add the following
import SudoEntitlements
let userClient = // ... see "Users" docs
do {
let entitlementsClient = DefaultSudoEntitlementsClient(
userClient: userClient
)
} catch {
// Handle initialization error. An error might be thrown due to invalid
// or missing configuration file.
}
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
See it in action. Be sure to take a look at the open source iOS sample app on Github that our team published as a reference for integrating the Entitlements SDK into your app as quickly and seamlessly as possible.
Integrate the Android SDK
Add this line to the dependencies section of the app module build.gradle
and synchronize your project with Android Studio.
dependencies {
implementation 'com.sudoplatform:sudoentitlements:$latest'
}
Client Initialization
To instantiate a client in your application, add the following
val userClient = // ... see "Users" docs
val entitlementsClient = SudoEntitlementsClient.builder()
.setContext(appContext)
.setSudoUserClient(userClient)
.build()
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
See it in action. Be sure to take a look at the open source Android sample app on Github that our team published as a reference for integrating the Entitlements SDK into your app as quickly and seamlessly as possible.
Integrate the JavaScript SDK
The JavaScript SDK is open source and compatible with CommonJS module loading.
Add this line to the dependencies
section of your application's package.json
file.
dependencies {
'@sudoplatform/sudo-entitlements':'$latest'
}
Client Initialization
To instantiate a client in your application, add the following
const DefaultSudoEntitlementsClient
= require('@sudoplatform/sudo-entitlements')
.DefaultSudoEntitlementsClient
const userClient = // see "Users" docs
const entitlementsClient =
new DefaultSudoEntitlementsClient(userClient)
You only need one client instance for a given user per device. Instantiating multiple clients with the same configuration and using them at the same time may cause unexpected runtime errors to occur.
See it in action. Be sure to take a look at the open source JavaScript sample app on Github that our team published as a reference for integrating the Entitlements SDK into your web application as quickly and seamlessly as possible.
Last updated