Android SDK
Introduction
This Android SDK provides an interface to load Aerosync-UI in native Android application. Securely link your bank account through your bank’s website. Log in with a fast, secure, and tokenized connection. Your information is never shared or sold.
1. Create a User
The Aerosync+Aeronetwork SDKs require a user identifier, aeroPassUserUuid, to be passed to the widget on launch. Follow the guide here to create a new user and access the user's aeroPassUserUuid.
2. Install Bank-Link-Sdk
Add latest verion of _com.aerosync/bank-link-sdk_ library to your project dependencies.
Maven Central: https://central.sonatype.com/artifact/com.aerosync/bank-link-sdk/overview
https://repo1.maven.org/maven2/
<dependency>
<groupId>com.aerosync</groupId>
<artifactId>bank-link-sdk</artifactId>
<version>2.1.0</version>
</dependency>implementation group: 'com.aerosync', name: 'bank-link-sdk', version: '2.1.0'3. Minimal example to implement bank-link-sdk
AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>Homepage.kt
package com.aerosync.test_client_android
import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.Toast
import com.aerosync.bank_link_sdk.EventListener
import com.aerosync.bank_link_sdk.EnvironmentType
import com.aerosync.bank_link_sdk.PayloadEventType
import com.aerosync.bank_link_sdk.PayloadSuccessType
import com.aerosync.bank_link_sdk.Widget
import com.aerosync.bank_link_sdk.Theme
class Homepage : AppCompatActivity(), EventListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_homepage)
}
fun onClick(v: View?) {
when (v?.id) {
R.id.button -> {
// open Aerosync widget
var config = Widget(this, this);
config.environment = EnvironmentType.PROD; //SANDBOX, PROD
config.deeplink = "aerosync://bank-link";
config.token = "<PROD TOKEN>";
config.configurationId = "xxx";
config.aeroPassUserUuid = "xxx";
config.defaultTheme = Theme.LIGHT;
config.open();
}
}
}
override fun onSuccess(event: PayloadSuccessType?, context: Context) {
// perform steps when user have completed the bank link workflow
// sample code
Toast.makeText(context, "onSuccess--> $event", Toast.LENGTH_SHORT).show()
val intent = Intent(context, Homepage::class.java)
context.startActivity(intent);
}
override fun onEvent(event: PayloadEventType?, context: Context) {
// capture all the Aerosync events
// sample code
Toast.makeText(context, "onEvent--> $event", Toast.LENGTH_SHORT).show()
}
override fun onError(error: String?, context: Context) {
// error handling
// sample code
Toast.makeText(context, "onError--> $error", Toast.LENGTH_SHORT).show()
}
override fun onClose(context: Context) {
// when widget is closed by user
// sample code
Toast.makeText(context,"widget closed", Toast.LENGTH_SHORT).show()
val intent = Intent(context, Homepage::class.java)
context.startActivity(intent);
}
}4. Bank Link SDK configuration
| Parameter | Type | Required | Description |
|---|---|---|---|
| token | string | Yes | Request AeroSync Token using GET /aggregatorCredentials endpoint. https://api-aeropay.readme.io/reference/aggregatorcredentials |
| environment | EnvironmentType | Yes | Permitted values are [SANDBOX, PROD] |
| configurationId | string | No | Unique ID that represents the client to apply the customization. |
| aeroPassUserUuid | string | Yes | AeroNetwork User ID |
| handleMFA | boolean | No | handle the additional MFA for balance refresh workflow |
| jobId | string | No | unique identifier for current job. Required if handleMFA is true. |
| connectionId | string | No | unique identifier for current Aerosync user. Required if handleMFA is true. |
| manualLinkOnly | boolean | No | User will only be able to link their bank manually. |
| defaultTheme | Theme | No | Launch the widget in dark or light mode. Permitted values are Theme.LIGHT / Theme.DARK |
5. Aerosync-UI Response:
Bank-Link-SDK will send response for below events:
5.1 onSuccess event
This event is triggered when the user successfully completes the bank-link workflow. The callback receives a PayloadSuccessType object.
| Property | Type | Description |
|---|---|---|
connectionId | String? | The unique identifier for the Aerosync connection in a single-account response. null in a multi-account response; read accounts instead. |
clientName | String | The name of the client associated with the session. |
aeroPassUserUuid | String | UUID of the authenticated AeroPass user. |
accounts | List<PayloadSuccessAccount>? | Present in the multi-account response, with one entry for each linked account. null in the single-account response. See Section 6. |
Single-account response
{
"connectionId": "xxx",
"clientName": "xxx",
"aeroPassUserUuid": "xxx",
"accounts": null
}Multi-account response
{
"connectionId": null,
"clientName": "xxx",
"aeroPassUserUuid": "xxx",
"accounts": [
{
"connectionId": "xxx",
"accountType": "CHECKING",
"accountNumberDisplay": "1234"
}
]
}5.2 onClose event
This event will be triggered when the user closes the AeroSync-UI window. If the user closes the AeroSync-UI window by tapping the 'X' button on any page, the callback function will be called which can be used to navigate the user to the previous page on parent component.
5.3 onEvent event
AeroSync-UI triggers this event on each page load. The callback receives a PayloadEventType object.
| Property | Type | Description |
|---|---|---|
pageTitle | String | The identifier or title of the page. |
onLoadApi | String | The identifier of the API loaded for that page. |
Example
{
"pageTitle": "Verify Your Identity",
"onLoadApi": "/token"
}5.4 onError event
Triggered when the WebView or AeroSync-UI fails to load, or a bank/account fails to connect. The callback receives a String describing the error (onError(error: String?, context: Context)) — any error code/message is contained within that string, it is not a structured object.
During the multi-account flow (Section 6), each account that fails to connect is reported through onError, while the accounts that connect successfully are returned via onSuccess — so a single session may fire both.
Example:
Code: AC-200 | Message: We had issues connecting to this banking institution. Please select a different bank or try again later.6. Multi-account linking (v2.1.0+)
Multi-account linking lets a user link multiple accounts in a single session, returning one connection per selected account.
Opt-in feature — disabled by defaultMulti-account linking is off by default. To enable it for your
configurationId, reach out to the Aerosync support team. It is available incom.aerosync:bank-link-sdkv2.1.0+.
Behavior
- When you launch the widget with a
configurationIdthat has multi-account linking enabled,onSuccessreturns the multi-account response:accountscontains a non-null list of linked accounts.- The top-level
connectionIdisnull.
- Otherwise,
onSuccessreturns the regular single-account response:connectionIdis set.accountsisnull.
Result handling in multi-accountEvery account that connects successfully is returned through
onSuccessin theaccountslist. If an account fails to connect, the widget reports it throughonError.
To integrate
-
Update
com.aerosync:bank-link-sdkto v2.1.0 or later:implementation group: 'com.aerosync', name: 'bank-link-sdk', version: '2.1.0' -
Pass your configurationId, with multi-account linking enabled, in the widget configuration.
-
Update your onSuccess handler to read accounts. Check event.accounts != null to distinguish a multi-account response from a single-account response.
// Launch the widget with a configurationId that has multi-account linking enabled.
val config = Widget(this, this)
config.configurationId = "xxx" // Configuration ID with multi-account linking enabled
// Set token, aeroPassUserUuid, environment, and other required configuration values.
config.open()
override fun onSuccess(event: PayloadSuccessType?, context: Context) {
val accounts = event?.accounts
if (accounts != null) {
// Process each account that connected successfully in this session.
accounts.forEach { account ->
Log.d(
"AeroSync",
"${account.connectionId} ${account.accountType} ${account.accountNumberDisplay}"
)
}
return
}
// The standard single-account response includes a top-level connection ID.
Log.d("AeroSync", "${event?.connectionId}")
}6.1 PayloadSuccessType
| Property | Type | Description |
|---|---|---|
connectionId | String? | The Aerosync connection ID for the single-account response. null in the multi-account response. |
clientName | String | The name of the client associated with the session. |
aeroPassUserUuid | String | UUID of the authenticated AeroPass user. |
accounts | List<PayloadSuccessAccount>? | One entry for each linked account in the multi-account response. null for the single-account response. |
6.2 PayloadSuccessAccount
| Property | Type | Description |
|---|---|---|
connectionId | String | The unique identifier for the Aerosync connection. |
accountType | String | The account type, such as CHECKING or SAVINGS. |
accountNumberDisplay | String | The masked or display account number, showing the last four digits. |
Updated about 2 months ago