This guide will walk you through integrating the Mobile Wallet SDK into your Android app.
This guide will walk you through integrating the Mobile Wallet SDK into your Android app.
Step 1: Adding Mobile Wallet SDK to your project
To begin integrating the Saakuru Mobile SDK into your Android application, you need to add the SDK package as a dependency in your project. The SDK package is hosted on Maven Central, making it easy to include in your app using Gradle:
Add the following config to your local properties file:
Add mapping to local.properties key values to your app/build.gradle file:
defaultConfig {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
// M1 SDK auth realm
buildConfigField("String", "SDK_REALM", "\"${properties["sdk.realm"]}\"")
// M1 SDK environment (dev, test, stage, prod)
buildConfigField("String", "SDK_ENVIRONMENT", "\"${properties["sdk.environment"]}\"")
// Wallet SDK Key (provided by AAG)
buildConfigField("String", "SDK_KEY", "\"${properties["sdk.key"]}\"")
// Client config url
buildConfigField("String", "SDK_CONFIG_URL", "\"${properties["sdk.config.url"]}\"")
// Client reference for API (provided by AAG)
buildConfigField("String", "SDK_API_CLIENT_REFERENCE", "\"${properties["sdk.api.client.reference"]}\"")
// Client Key Phrase for API
buildConfigField("String", "SDK_API_KEY_PHRASE", "\"${properties["sdk.api.key.phrase"]}\"")
}
Step 2: Initializing SDK
Initialize MetaOneSDKManager instance:
metaOneSDKManager = new MetaOneSDKManager(this);
Map your BuildConfig values to sdkConfig object:
SDKConfig sdkConfig = new SDKConfig(BuildConfig.SDK_REALM, BuildConfig.SDK_ENVIRONMENT, BuildConfig.SDK_KEY, BuildConfig.SDK_CONFIG_URL, BuildConfig.SDK_API_CLIENT_REFERENCE, VERSION);
Initialize MetaOne SDK:
metaOneSDKManager.initialize(sdkConfig)
Step 3: Creating a User Session
To successfully initialize a user session, your back-end integration has to be ready first. Your backend should receive an Authorization token during the initialization request.
Initialize the session by calling:
metaOneSDKManager.login(token, this, callback)
Your session is initialized. You can now use all other functions that require Authorization
Call metaOneSDKManager.setupUserData() to initialize user profile data