This document provides the information required by Financial Institutions (e.g. banks) with Android platform applications to prepare and pretest the implementation of Personetics products and widgets, and integrate them in the bank’s own application.

A sample app is provided with the initial vanilla package. The sample app provides examples of the widgets implementation.

Operating Systems

Supported os target versions:

31,32,33,34

Deprecation policy:

  • Time frame: Personetics client version 3.9 will support the Android target versions mentioned above for a period of two years from the launch date of the Personetics client version, as long as the operating system provider continues to support these versions.
  • Scope: During this period, support for the Personetics client version includes updates from both Personetics client and the operating system versions.
  • Upgrade implications: In case a customer upgrades their Personetics client version, this may result in changes to the supported operating system versions. Please contact your project manager for further details.

Package Description

The Android package includes two separate elements:

FileDescription
Personetics_android_integration_project.zipSample application files for Android. Provides all the relevant code examples and shows examples of widget implementation. This unit is only provided with the (initial) vanilla package delivery.
personetics-release.aarThis is the Android Archive Library (aar). This is initially vanilla implementation, and is followed by the customized code that is integrated into the FI's project.

Running the Sample App

  1. In Android Studio, configure a virtual device instance.
  2. Extract the Personetics_android_integration_project.zip file to an accessible directory.
  3. Open a new project and import the Personetics_android_integration_project contents.
  4. Set the access to 'predefined':
    In the file PersoneticsApppIntegration/app/src/main/main/res/values/booleans.xml, set 'predefined' mode as 'true': <bool name="is_predefined_mode">true</bool>
  5. Select the virtual device instance, and click Run. The sample app appears.

The app provides two types of elements:

  • Responses to API requests. For example, Number of Insights, displays the response to Get Number of Insights.
  • Widgets operations – click on the relevant widget. For example, Start Hub Widget, displays an example of hub widget implementation. (To go back to the main screen, click the 'Back' control button in the device emulation pane.)

Note: The Budget and Subscription widgets can be accessed by running the Dashboard Trackers or Hub widget (Budget only), and clicking the relevant tracker.

Integration Process

The integration process consist of the following phases:

  1. Integrate the *aar package into the bank’s application.
  2. Import the Personetics widget components.
  3. Implement the eventDelegate Object.
  4. Call startWidget to open the widget – detailed in the Client API document

Integrating the AAR into the Bank's App

  1. Add “personetics-release.aar” as a dependency in your project’s app/libs folder. (Create the folder if it does not exist.)
  1. Depending on you Android app, add one of the the following set of dependencies to the build.gradle file (located in the app/src folder), as follows:

Either:

  • compile fileTree(dir: 'libs', include: ['*.jar'])
  • implementation (name:'personetics-release', ext:'aar')

Or:

  • implementation fileTree(include: ['*.jar'], dir: 'libs')
  • implementation (name:'personetics-release', ext:'aar')

Importing the Personetics Widgets

Following the integration of the AAR into the bank’s application (Section ‎2.2), import the Personetics widgets by adding the following code:

import com.personetics.module.Personetics; 
import com.personetics.module.BridgeServices.PersoneticsDelegate;

In addition:

A sample of this code can be reviewed and debugged by running the sample project attached to the package. To run this project: Unzip “Personetics_android_integration_project.zip” and run the contained Android project.
The app works in stub mode by default. Live server is not mandatory in the first steps.

Configure the Class Delegate Protocol

Create protocol with class Delegate and implement the Delegate functions provided by Personetics.
Refer to the following for examples and available functions:

Call startWidget

Create a class that implements the Personetics’ event interface (delegate) and add the relevant code as detailed below.

  1. Initiate Personetics object.
    _personetics = new Personetics(personeticsDelegate);
  2. Create an object with all the relevant properties.
    Below are examples of property settings. Refer to Key List and Examples for the full list of properties and examples.
HashMap<String, Object> config = new HashMap<String, Object>();  
JSONObject configurations = new JSONObject();  
JSONObject params = new JSONObject();  
JSONObject assets = new JSONObject();  
JSONObject internationalization = new JSONObject();  
JSONObject theme = new JSONObject();`  
  
params.put(Personetics.PDB_USER_ID, "B_1010");
configurations.put(Personetics.PDB_WIDGET_TYPE, "inbox");
configurations.put(Personetics.PDB_DEVICE_TYPE, "android");
configurations.put(Personetics.PDB_SELECTOR_STRING, "#root");
configurations.put(Personetics.PDB_PARAMS, params);
  
assets.put(Personetics.PDB_BASEURL,<baseURL>);
assets.put(Personetics.PDB_USEREMOTEASSETS, false);
  
internationalization.put(Personetics.PDB_LANGUAGE, "en");
theme.put(Personetics.PDB_DARKMODE, false);
  

config.put(Personetics.PDB_CONFIGURATIONS, configurations);  
config.put(Personetics.PDB_ASSETS, assets);  
config.put(Personetics.PDB_INTERNATIONALIZATION, internationalization);  
config.put(Personetics.PDB_THEME, theme);

  1. Call Personetics startWidget API function.
    _personetics.startWidgetWithView(this, config);

Note: For more code examples, see the Personetics_android_integration_project.zip file attached to the package. The code can be found under: ”InboxFragment.java”,”StoryFragment.java”

Delegate Functions

Function NameDescription
@Override
public void navigateToPage(JSONObject data) {}
Values can optionally be assigned (function must be included).

Description: Relevant if Call To Action is activated. Personetics invokes this function when user clicked a certain button that requires the bank action.

The bank should use the provided information to navigate to the relevant page.

@Override
public void navigateToPage(JSONObject data) {}
@Override
public void personeticsEvent(final JSONObject json) {}
Value definitions required for specific products.

Description: Triggered by events of on incidents captured on the web.

Example: Event ‘teaserClick’ is generated when the end-user clicks on a teaser. In this case, the bank should implement (write code) for relevant behaviour, where the default behavior implementation opens the story widget.

For a full list of events, refer to Widget Client API doc, Delegate Callbacks section, WidgetEvent, Event Types.

Note: There are various event types. Be sure to check what is the event type and act according to the business use-case.
@Override
public void sendRequestToPServer(String reqId, String requestBody) {}
Mandatory – Personetics does not support independent HTTP calls. All HTTP calls should be made by the bank secured channel using the bank application code.

Personetics calls this function when an HTTP request should be made to the server. The function sends two properties:
requestBody: Should be sent as the body of the request.
requestId: Should be passed back with the response when using “handleServerResponse()".
@Override
public void sendRequestToEnrichServer(String reqId, String requestBody) {}
Mandatory – Personetics does not support independent HTTP calls. All HTTP calls should be made by the bank secured channel using the bank application code.

Personetics calls this function when an HTTP request should be made to the server. The function sends two properties:
requestBody: Should be sent as the body of the request.
requestId: Should be passed back with the response when using “handleServerResponse()".
@Override
public void sendRequestToServer(String reqId, String requestBody) {}
Mandatory. Personetics supports two types of services: Pserver and Enrich server. Following a Personetics call to one of the two services (Pserver/Enrich), this function will be automatically called when an HTTP request should be made to the services.

The bank should send an HTTP request. The body of that request is the same body passed by this function. When getting a server response, the bank should call “handleServerResponse()” with the server response and the same requestId

In general, communication with the server – Post parameters to server with request body (this is a delegate function). In addition to the parameters received from RequestToServer, the URL parameter is also received from the Pserver/EnrichServer functions.
@Override
public void sessionError(String data, String requestId){
}
Optional. Do not have to assign values to function BUT function must be included in the ‘configuration file’

Personetics will call this function in case of an error.
@Override
public void sessionEnded(String data, String requestId){}
Optional. Relevant only if Personetics’ widgets have a “Close” button according to the design

Personetics will call this function when the story “Close” button is clicked.

Default behavior: The bank should close the controller\View.
@Override
public void goToPersoneticsWidget(HashMap<String, Object> config) {}
This function is invoked when the Personetics widget is triggered. It takes the configuration properties as arguments and uses them to set the widget fragment.
void onNumberOfInsightsReceived(String response);This function updates the number of received insights following to ‘numberOfInsightsReqId’ api

Key List and Examples

This section lists the relevant parameters in the required syntax, along with examples. Refer to the API document for a full description of the parameters.

Note: The keys are relevant for Android startWidgetWithView and startWidgetWithFragment.

NameAndroid Examples
Personetics.PDB_WIDGET_TYPEconfigurations.put(Personetics.PDB_WIDGET_TYPE, "inbox");
Personetics.PDB_DEVICE_TYPEconfigurations.put(Personetics.PDB_DEVICE_TYPE, "android");
Personetics.PDB_LANGUAGEinternationalization.put(Personetics.PDB_LANGUAGE, "en");
Personetics.PDB_USER_IDparams.put(Personetics.PDB_USER_ID, getResources().getString(R.string.default_user));
Personetics.PDB_PAYLOADparams.put(Personetics.PDB_PAYLOAD, jsonResponse);
Personetics.PDB_SELECTOR_STRINGconfigurations.put(Personetics.PDB_SELECTOR_STRING, "#root");
Personetics.PDB_PROTOCOL_VERSIONconfigurations.put(Personetics.PDB_PROTOCOL_VERSION, "2.6");
Personetics.PDB_CTX_IDconfigurations.put(Personetics.PDB_CTX_ID, "dashboard");
Personetics.PDB_WIDGET_WIDTHconfig.put(Personetics.PDB_WIDGET_WIDTH, "500");
Personetics.PDB_WIDGET_HEIGHTconfig.put(Personetics.PDB_WIDGET_HEIGHT, "500");
Personetics.PDB_INSIGHT_IDparams.put(Personetics.PDB_INSIGHT_ID, config.get("insightId"));
Personetics.PBD_USE_CASE_IDparams.put(Personetics.PDB_USE_CASE_ID, config.get("useCaseId"));
Personetics.PDB_INSTANCE_IDparams.put(Personetics.PDB_INSTANCE_ID, config.get("instanceId"));