Android Ready UX SDK

Introduction

To get started quickly with Planky Connect for Android, clone the GitHub repository and run the example. You will need to sign-up for the free API keys through our Developer Console.

Requirements

  1. Install or update Android Studio to version 3.2 or greater
  2. We support Android 5.0 and greater
  3. Planky Client Id

QuickStart

The easiest way to get started is to clone the repository https://github.com/FriendlyScore/FriendlyScore-Connect-Android-Example. Please follow the instructions below to provide the necessary configuration and to understand the flow.

Getting Set up

In your project-level Gradle file (build.gradle), add rules to include the Android Gradle plugin. The version should be equal to or greater than 3.2.1

1 2 3 buildscript { ... dependencies { classpath 'com.android.tools.build:gradle:3.2.1' } }

In your project-level Gradle file (build.gradle), add the maven repository from which you will download the planky connect library

1 2 3 4 5 6 7 allprojects { repositories { maven { url "https://jitpack.io" } } }

Planky Configuration

In the project-level gradle.properties file please add the following configuration values

1 2 3 4 //This value must be specified CLIENT_ID=client_id //You must specify the value the SDK will use for android:scheme to redirect back to your app. https://developer.android.com/training/app-links/deep-linking APP_REDIRECT_SCHEME=Please Provide this value.

Add the following values to your app-level build.gradle file (in the demo app/build.gradle). Now we must read the configuration to create the string resources that will be used by the Planky Android SDK.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 android { ... compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 } defaultConfig { // Must Provide these Values resValue "string", "fs_client_id", (project.findProperty("CLIENT_ID") ?: "NO_CLIENT_ID") resValue "string", "fs_app_redirect_scheme", (project.findProperty("APP_REDIRECT_SCHEME") ?: "NO_APP_REDIRECT_SCHEME_PROVIDED") } }

In your module or app-level gradle file (in the demo app/build.gradle) please add the Planky Android SDK library listed below to your list of dependencies

1 2 3 4 dependencies { ... implementation 'com.github.friendlyscore.fs-android-sdk:friendlyscore-connect:1.0.21' }

Start Planky

In order to start Planky for your customer you must have the userReference for that customer. The userReference uniquely identifies the customer in your systems. This userReference can then be used to access information from the Planky API.

1 public String userReference = "YOUR_USER_REFERENCE";

In order to listen when the customer returns from the PlankyView in your onActivityResult, you must provide the requestcode that you will be using

1 public final int REQUEST_CODE_FRIENDLY_SCORE = 11;

You can select which environment you want to use the Planky SDK in.

EnvironmentDefinitions
sandboxUse this environment to test your integration
productionUse this environment when deploying the live application

These environments are listed in the SDK as below

1 2 Environments.SANDBOX Environments.PRODUCTION

Define the environment variable

1 public Environments environment = Environments.PRODUCTION;

Customization

Theme

PlankyConnect can be presented with a light (default) or dark theme, which are predefined list of colors and icons. To use custom colors for the categories, you must override the color keys in your application. You can also create a custom theme and use that value when you trigger the ConnectUI. Custom theme example is included in the styles.xml. The color keys and descriptions are in the Colors section. You must extend the Default theme while creating the custom theme as shown below

1 2 <style name="CustomConnectDarkTheme" parent="ConnectDarkTheme"> </style>

The existing themes for Connect are declared below

1 2 3 4 5 6 /** Connect Light Theme - R.style.ConnectLightTheme Connect Dark Theme - R.style.ConnectDarkTheme */ public int connectUITheme = R.style.CustomConnectDarkTheme

Other

1 2 3 4 5 6 7 8 9 10 11 12 13 14 /** Show Only Icon for Back Button */ public Boolean showOnlyIconBackButton = false /** Text Label for Back Button */ public String backButtonLabel = "Back" /** Force App to start with Browser flow (Default set to browser flow) */ public Boolean forceBrowserFlow = false

Initiate PlankyView using the above values

1 2 3 public void startFriendlyScore() { FriendlyScoreView.Companion.startFriendlyScoreView(this, getString(R.string.fs_client_id), userReference, REQUEST_CODE_FRIENDLY_SCORE, environment, connectUITheme, showOnlyIconBackButton, backButtonLabel, forceBrowserFlow); }

Colors

Colors across views

Color KeyDescription
connectBackgroundColorBackground color for all views in the SDK
connectDividerColorDivider color for all view in the SDK
connectCancelButtonColorBackground color for Cancel, Disconnect Buttons
connectNextButtonColorBackground color for Next, Confirm Button
connectButtonTextColorText color for Buttons
connectBankDetailMarkerColorColor for the marker on the detail view for a connected bank
connectNavigationButtonBackgroundColorBackground color for navigation button in the toolbar
connectNavigationBackButtonItemsColor of the back button for the navigation button
connectToolbarIconsColorColor for the search icon in the toolbar
connectToolbarTextColorColor for the search field cursor
connectToolbarSearchTextColorColor for the search text query
connectToolbarSearchCursorColorColor for the search field cursor

Colors for View: List of Banks

Color KeyDescription
connectBankItemBackgroundColorBackground color for bank item in the list of banks
connectBankItemTextColorText color for bank item in the list of banks
connectBankItemDisabledTextColorText color for bank item if its disabled or not available in the list of banks
connectBankItemBorderColorBorder color for the bank item in the list of banks
connectedBankItemConnectedStatusColorColor of the connected status icon for the bank item in the list of banks
connectBankItemUnavailableStatusColorColor of the unavailable status icon for the bank item in the list of banks

Colors for View: Filter

Color KeyDescription
connectFilterHeaderDisabledColorColor for the filter header background color
connectFilterPageTitleColorColor for the filter header text color
connectFilterPageSubTitleColorColor for the filter item text color

Handle Response from Planky

If you need to know when the user returns from the Planky Flow add this to your Activity or Fragment. The onActivityResult is called when the SDK is closed. The data object returned in onActivityResult contains both errors and events.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == REQUEST_CODE_FRIENDLY_SCORE){ //Present if there was error in creating an access token for the supplied userReference. if(data!=null && data.hasExtra("userReferenceAuthError")){ //Do Something } //Present if there was service denied. if(data!=null && data.hasExtra("serviceDenied")){ if(data.hasExtra("serviceDeniedMessage")){ String errorDescription = data.getStringExtra("serviceDeniedMessage"); } } //Present if the configuration on the server is incomplete. if(data!=null && data.hasExtra("incompleteConfiguration")){ if(data.hasExtra("incompleteConfigurationMessage")){ String errorDescription = data.getStringExtra("incompleteConfigurationMessage"); } } //Present if there was error in obtaining configuration from server if(data!=null && data.hasExtra("serverError")){ //Try again later } //Present if the user completed the entire flow for Forecast if(data!=null && data.hasExtra("userCompletedFlow")){ //Success } // //Present if the user closed the flow if(data!=null && data.hasExtra("userClosedView")){ //The user closed the process } } }

Error Definition

ErrorDefinitions
userReferenceAuthErrorPresent if there was an authentication error for the supplied userReference.
serviceDeniedPresent if service was denied. Please check the description for more information.
incompleteConfigurationPresent if the configuration on the server is incomplete. Please check the description for more information.
serverErrorPresent if there was a critical error on the server.

Response State Definition

StateDefinitions
userClosedViewPresent if the customer Closed the Planky Flow.
userCompletedFlowPresent if the customer Completed the Planky flow.

Was this article helpful?

Friendly Score UK Ltd.

42 Brook Street, Mayfair

London W1K 5DB

Call us on +44 20 3709 6726

Company registered in England

Company number 09168668, ICO ZA111687

VAT registration number 206 9758 80

Authorised and Regulated by the Financial Conduct Authority. (FRN: 821100, 781963)