Using the Android SDK

This topic provides detailed information on how to use the Android SDK.


Follow these steps to install Android SDK:

  1. Place the "netspendsdk-release.aar" file that you received into your Android app module's libs directory.
  2. Add implementation files ('libs/netspendsdk-release.aar') to your app module's dependencies in build.gradle as shown in the sample code below:
dependencies {
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core-ktx:1.0.2'
    // Note: Add the following as dependencies. Gradle does not automatically 
    // include transitive dependencies of `.aar` files when used outside of a 
    // maven registry.
    implementation ''
    implementation 'org.bitbucket.b_c:jose4j:0.6.4'
    implementation ''
    // NetspendSDK framework
    implementation files('libs/netspendsdk-release.aar')

This framework is built with Kotlin, but it can be used with Java as well. The Android minSdkVersion is set to 21, which equates to Android 5.0 (Lollipop).


When your application starts, make sure to initialize the Netspend SDK. This will allow for the downloading and caching of external assets without any noticeable delays when launching micro-apps. As part of the initialization process, ensure to set up the theme and branding information, to facilitate a seamless appearance of micro-apps within your mobile application.

Global Initialization

You need the global single initialization once per app life-cycle, typically in onCreate of your MainActivity. to initialize, you need, sdkID, iovation_token. You also need to configure theme and branding details.

import com.netspend.sdk.NetspendSdk
  // The SDK ID for your integration, given from Netspend. 
  // This is not a secret value.
  // The theme configuration
  // Branding configuration, see each micro-app for details
  // Iovation Token using the Fraudforce lib

Extend the NetspendSdkActivity Base Class

To use this SDK, extend the NetspendSdkActivity Android Activity Class. You must implement the following methods to receive notifications about the Netspend User Activity.

In the State Change blocks to close your activity when key user events occur, you will call the standard finish() class.

import com.netspend.sdk.NetspendSdkActivity
import com.netspend.sdk.NetspendSdkPurposeState
class MyNetspendActivity : NetspendSdkActivity() {
  override fun onNetspendSdkEvent(event: String, data: Map<String, Any>)  {
      System.out.println("Received event from current NetspendSdk purpose: " + event)
  override fun onNetspendSdkStateChange(state: NetspendSdkPurposeState, data: Map<String, Any>){
    when(state) {
      NetspendSdkPurposeState.STARTED ->
        System.out.println("[NetspendSDK] Purpose $purposeName has been started!")
      NetspendSdkPurposeState.CANCELLED -> {
        System.out.println("[NetspendSDK] Purpose $purposeName was requested to be canceled by the user!")
      NetspendSdkPurposeState.ERROR -> {
        System.out.println("[NetspendSDK] Purpose $purposeName encountered an error!")

      NetspendSdkPurposeState.SUCCESS -> {
        System.out.println("[NetspendSDK] Purpose $purposeName was successful!")

See Customization for detailed information on theme and branding.