>  Switch To Link 5 and API v2 Documentation

Android

Follow these instructions to set up your Android integration.

Setup#

Android Link SDK provides a way to integrate Argyle Link into your Android app.

The SDK supports API level 23 and above (distribution stats).

Argyle recommends that you lock your app to portrait orientation.

Important: When using tools like Proguard to obfuscate your code, make sure to exclude Android Link SDK package (com.argyle._) from the process, it may cause unexpected runtime issues otherwise. You can do this by adding this line to your proguard-rules.pro:-keep class com.argyle. { _; }

The target configuration is currently set to:

  • minSdkVersion = 23
  • Kotlin = 1.6.21
  1. Add the SDK dependency:

    Gradle configuration:

    1dependencies {
    2    implementation 'com.argyle:argyle-link-android:4.x.x'
    3}
  2. Create the SDK configuration:

    1val config = ArgyleConfig.Builder()
    2  .loginWith("YOUR_LINK_KEY", "https://api-sandbox.argyle.com/v1", "USER_TOKEN")
    3  //.linkItems(arrayOf("lyft", "uber"))
    4  .setCallbackListener(object : Argyle.ArgyleResultListener {
    5
    6    override fun onUserCreated(userToken: String, userId: String) {
    7      Log.d("Result", "onUserCreated:  userId: $userId, userToken: $userToken")
    8    }
    9
    10    override fun onAccountCreated(accountId: String, userId: String, linkItemId: String) {
    11      Log.d("Result", "onAccountCreated: accountId: $accountId, userId: $userId, linkItemId: $linkItemId")
    12    }
    13
    14    override fun onAccountConnected(accountId: String, userId: String, linkItemId: String) {
    15      Log.d("Result", "onAccountConnected: accountId: $accountId, userId: $userId, linkItemId: $linkItemId")
    16    }
    17
    18    override fun onAccountUpdated(accountId: String, userId: String, linkItemId: String) {
    19      Log.d("Result", "onAccountUpdated: accountId: $accountId, userId: $userId, linkItemId: $linkItemId")
    20    }
    21
    22    override fun onAccountRemoved(accountId: String, userId: String, linkItemId: String) {
    23      Log.d("Result", "onAccountRemoved: accountId: $accountId, userId: $userId, linkItemId: $linkItemId")
    24    }
    25
    26    override fun onAccountError(accountId: String, userId: String, linkItemId: String) {
    27      Log.d("Result", "onAccountError: accountId: $accountId, userId: $userId, linkItemId: $linkItemId")
    28    }
    29
    30    override fun onPayDistributionSuccess(accountId: String, userId: String, linkItemId: String) {
    31      Log.d("Result", "onPayDistributionSuccess: accountId: $accountId, userId: $userId, linkItemId: $linkItemId")
    32    }
    33
    34    override fun onPayDistributionError(accountId: String, userId: String, linkItemId: String) {
    35      Log.d("Result", "onPayDistributionError: accountId: $accountId, userId: $userId, linkItemId: $linkItemId")
    36    }  
    37
    38    override fun onError(error: ArgyleErrorType) {
    39      Log.d("Result", "onError: error: $error")
    40    }
    41
    42    override fun onTokenExpired(handler: (String) -> Unit) {
    43      handler("new_token")
    44    }
    45    
    46    override fun onUIEvent(name: String, properties: Map<String, Any>) {
    47      Log.d("Result", "onUIEvent: $name, properties: $properties")
    48    }
    49
    50    override fun onClose() {
    51      Log.d("Result", "onClose")
    52    }
    53  })
    54.build()

    The API host in this SDK configuration example is set to the Argyle Sandbox API (https://api-sandbox.argyle.com/v1). It's a good idea to test your implementation in Sandbox mode first, then change this to the Production API (https://api.argyle.com/v1) when you are ready to go live.

  3. Start the flow.

    1Argyle.instance.init(config);
    2Argyle.instance.startSDK(this)

Normally, the user closes Link but you can also close it by calling Argyle.instance.close().

We strongly recommend upgrading the SDK as soon as there is a new version available. Doing so will help you provide the best Argyle Link experience in your application.

To receive notifications when a new release is issued, you can watch for releases on our repositories or subscribe to our Changelog.

Configuration#

Argyle Link provides multiple configuration options and callbacks that customize how this UI element functions in your application. The only argument that is mandatory when invoking Argyle Link is the linkKey, which you can find in Argyle Console.

By default, anytime Argyle Link is initialized, it will be treated as a new session for a new user. To ensure your users retain their previous state in Argyle Link when it is re-initialized for them, your application must use the userToken parameter.

For a full list of Link configuration parameters, see the Link reference.

User tokens#

User tokens are temporary access keys that let you start Argyle Link for an existing user.

Tokens are short-lived. Generate a new token using the API every time you initialize Argyle Link for a returning user.

You can create user tokens using the /user-tokens endpoint.

Make sure that you request user tokens on your server-side and your client_id and client_secret are never exposed on the front-end.

Callbacks#

For a full list of callbacks, see the Link reference.

Upgrade#

See the Link SDK for Android upgrade guide for instructions on upgrading your integration.

Updating Argyle status...
© 2024 Argyle Systems Inc.argyle.com