Connect Android SDK

The Connect Android SDK allows you to integrate Finicity Connect into your mobile applications.

The SDK features Connect in a web view so that you can implement it anywhere you want within your own mobile applications. You can also use the events feature to monitor when consumers start and complete the Connect application, when it’s canceled or if an error has occurred.

Compatibility

The Connect Android SDK supports the following Android versions.

  • Android 5.0 (Lollipop) or later

  • minSdkVersion 21 or later

Download the SDK

Step 1— Add the SDK dependency to your project

Step 2—Update Android application settings

Add internet permissions to the AndroidManifest.xml file.

Sample
 <uses-permission android:name="android.permission.INTERNET"> 

Step 3—Add code to start the Connect SDK

The Connect class contains a start method that when called, starts an activity with the supplied event listener. The SDK only allows a single instance of the Connect activity to run. If you start Connect while a Connect activity is already running, a RuntimeException is thrown.

Connect Class

The Connect Android SDK’s main component is the Connect class that contains a static start method, which runs an activity that connects with the EventHandler.

Sample
 public static void start(Context context, String connectUrl, EventHandler eventHandler) 
Sample
 fun start(context: Context, connectUrl: String?, eventHandler: EventHandler?) 
Argument
contextThe Android Context is referenced by Connect when an activity starts.
connectUrlThe SDK loads the Connect URL.

eventHandler
A class implementing the EventHandler interface.

EventHandler Interface

Throughout Connect’s flow events about the state of the web application are sent as JSONObjects to the EventHandler methods.

The onUserEvent handler will not return anything unless you’re specifically targeting Connect 2.0 (coming soon).

Sample
 public interface EventHandler {
void onLoaded();
void onDone(JSONObject doneEvent);
void onCancel();
void onError(JSONObject errorEvent);
void onRouteEvent(JSONObject routeEvent);
void onUserEvent(JSONObject userEvent);
}
Sample
 interface EventHandler {
fun onLoaded()
fun onDone(doneEvent: JSONObject?)
fun onCancel()
fun onError(errorEvent: JSONObject?)
fun onRouteEvent(routeEvent: JSONObject?)
fun onUserEvent(userEvent: JSONObject?)
}
Events
loadedSent when the Connect web page is loaded and ready to display.
doneSent when the user successfully completes the Connect flow.
cancelSent when the user cancels the Connect flow.
errorSent when there is an error during the Connect flow.
routeSent when the user navigates to a new route or screen in Connect.
userSent when user events occur in Connect.

Manually stop a connect activity

The Connect activity will automatically finish on done, cancel, and error events.

You can manually finish a Connect activity by invoking:  

Sample
 Connect.finishCurrentActivity() 

If there isn’t a current Connect activity running, then the method will throw a RuntimeException.

Process Restarts

Android sometimes stops your application’s process and restarts it when your application is refocused. If this happens, the Connect activity automatically finishes when the application resumes. If you want Connect to run again, call the start method. See Connect Call.