Android
Installation
Update your project plugins
In your root-level (project-level) Gradle file (build.gradle
), add rules to include the Android Gradle plugin. Check that you have Google's Maven repository as well.build.gradle (Project-level)
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
maven { url 'https://jitpack.io' } // Include to import Fuse Connect Android SDK
}
dependencies {
// ...
}
}
Add the FuseConnect SDK to your app
In your module (app-level) Gradle file (usually app/build.gradle
), add a line to the bottom of the file. The latest version of the FuseConnect SDK is and can be found on Maven Central.
android {
defaultConfig {
minSdkVersion 21 // or greater
}
}
dependencies {
// ...
implementation 'com.github.Cluttr-eng:android-fuse-connect:0.0.9'
}
Add the FuseConnect Activities to your Android Manifest
Add the following activities to your AndroidManifest.xml
file between the <application>
tag.
<application>
<!-- ... -->
<activity
android:name="com.letsfuse.connect.FuseConnectActivity"
android:theme="@style/Theme.AppCompat.Light">
</activity>
<activity
android:name="com.letsfuse.connect.SnaptradeConnectActivity"
android:theme="@style/Theme.AppCompat.Light">
</activity>
</application>
Opening Fuse Connect
Starting Fuse Connect for Android experience begins with creating a client secret. Once the client secret is passed to your app, show the select bank screen by passing the secret to the FuseConnectActivity when launching it. Note that each time you open Fuse Connect, you will need to get a client secret from your server.
import com.letsfuse.connect.FuseConnectActivity
val intent = Intent(currentActivity, FuseConnectActivity::class.java)
val REQUEST_CODE = 928
intent.putExtra("clientSecret", clientSecret)
currentActivity?.startActivityForResult(intent, REQUEST_CODE)
overrideBaseUrl?.let { url ->
FuseConnectActivity.WEB_VIEW_BASE_URL = url
}
FuseConnectActivity.onInstitutionSelected = { institution_id, callback ->
institutionSelectedCallbackInstance = { linkToken -> callback(linkToken) }
// Handle callback
}
FuseConnectActivity.onSuccess = { publicToken ->
// Handle callback
}
FuseConnectActivity.onExit = { exit ->
// Handle callback
}
Method parameters
Field | Type | Required | Description |
---|---|---|---|
clientSecret | String | Yes | A string representing the generated client secret. This secret is used to authenticate the API and grant access to bank data. See /session |
onInstitutionSelected | Function | Yes | A function that is called when a user selects an institution to link. The closure should expect a 2 arguments - Institution_id - Represents the unique identifier for the selected bank. - callback - Receives the link token generated by the backend. See /link/token for how to generate a link token. |
onSuccess | Function | Yes | A function that is called when the user successfully connects their bank account. The closure should expect a single argument: - A publicToken that can be exchanged for an access token to access the user's bank data. See /financial_connections/public_token/exchange |
onExit | Function | Yes | A function that is called when the user exits the API. The close should take two arguments: err - An error object, if an error occurred during the connection process. |
Updated over 1 year ago