Android SDK - Development Environment Setup

Paydiant’s Android SDK Package is delivered as a compiled bundle that contains all the necessary components for building a mobile payments app on the Android operating system that implements all the functionality offered by the Paydiant mobile payments platform.

Android SDK Package Contents

The SDK Package for Android development includes the following contents:

Paydiant Android SDK jar file

  • android-sdk-6.7.0.0.a or later

Set Up Your Development Environment

Before you begin using the SDK package, create a development environment as follows:

  1. Install Homebrew if you are using a Mac.
  2. Make sure that Java 7 or Java 8 is installed on your machine. You can install Java by downloading the Java Development Kit from the Oracle Java website. Check your Java version by typing javac -version in the command line. The output should display the Java version, Java runtime environment, and the Java hotspot version.
  3. Install and setup Gradle to your computer. If Homebrew is installed on your machine, you can do this by typing brew install guide in the command line prompt. This will install Gradle and some of the necessary dependencies on your machine. Third party dependencies that need to be installed are:
  compile fileTree(dir: 'libs', include: ['\*.jar']) //add the SDK jar and zxing jar from libs folder
  compile 'org.springframework.android:spring-android-rest-template:2.0.0.M4'
  compile 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.8.1'
  compile 'com.squareup.okhttp3:okhttp:3.4.1'
  compile 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
  compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
  compile 'com.android.support:multidex:1.0.1'
  compile 'com.google.android.gms:play-services-location:9.2.1'
  compile 'com.google.android.gms:play-services-gcm:9.2.1'
  
  1. If Homebrew is not installed on your machine, download the Gradle binaries and follow the instructions in the installation guide.
  2. Download the Android SDK and install Android Studio.

Configure Your Android API for the Paydiant Project

Paydiant’s Android SDK relies on certain Android API configurations and prerequisites, as defined in the AndroidManifest.xml.

Paydiant supports Android OS versions totaling up to 80% of the market share, including the latest OS version and any historical versions that have 10%+ of the market share. Android adoption is monitored each month and OS support is adjusted accordingly.

Required SDK version

Version 19 or later

For example: < uses-sdk android:minSdkVersion="19" android:targetSdkVersion="23"/ >

Required features

  • android.hardware.camera.autofocus

Required permissions

  • android.permission.INTERNET
  • android.permission.READ_PHONE_STATE
  • android.permission.ACCESS_NETWORK_STATE
  • android.permission.CAMERA
  • android.permission.FLASHLIGHT
  • android.permission.ACCESS_WIFI_STATE

Sample Android manifest

The following code sample provides an example of the AndroidManifest.xml file configuration.

< ?xml version="1.0" encoding="utf-8"?>
< manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.paydiant.android" android:versionCode="1000" ndroid:versionName="1.0.0">
< uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11"/>
< uses-feature android:name="android.hardware.camera.autofocus" />
< uses-permission android:name="android.permission.INTERNET" />
< uses-permission android:name="android.permission.READ_PHONE_STATE" />
< uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
< uses-permission android:name="android.permission.CAMERA" />
< uses-permission android:name="android.permission.FLASHLIGHT" />
< uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
< application android:label="@string/app_name" android:icon="@drawable/icon"
android:name=".common.ApplicationContext"
android:theme="@android:style/Theme.NoTitleBar"
android:hardwareAccelerated="true">
< !-- List of Activities -->
< activity android:name=".MainActivity"
android:label="@string/app_name" android:screenOrientation="portrait">
< intent-filter>
		 ...
< /intent-filter>
< /activity>
< activity ....>
...
< /activity>
< !-- List of services -->
< service android:name= "com.paydiant.android.ui.service.logging.PaydiantLoggingService" />
< service .... />
  ...
 ...
< service .... />
< /application>
< /manifest>

Configure Your Development Environment with the Paydiant Service

Define the following environment variables for your development environment:

Variable Description
Host The Host name where the mobile gateway resides, for example, demo.paydiant.com
Protocol The protocol to be used when calling the mobile gateway. For this version it is https.
Host URL Path The mobile gateway path relative to the host. Always set this to /mobile. When constructing the HOST URL, this should be appended to the Host value above, for example, demo.paydiant.com/mobile.
App Signature The identification of your application’s signature verification, in byte format, which can easily be converted to the string value.
API Key The identifier of the specific API service to which you are directing each call from the app.

Configure Your SDK Instance

Prior to beginning any development using this SDK, you must initialize the Paydiant SDK using the following method:

com.paydiant.android.config.PaydiantApplicationConfig#setupPaydiantApplicationConfig(String hostURL, String protocol, ContextWrapper contextWrapper, byte[] appSignature byte[] apiKey)

Note: Application Context is required at initialization and will result in an illegalArgumentException if not included, and appSignature and apiKey values must be specified in byte format, not string.

The following code sample shows a sample SDK configuration.

private static final String HOST_IP = "";
private static final String HOST_URL = HOST_IP + "";
private static final String PROTOCOL = "";
private ContextWrapper androidContextInstance;
private byte[] appSignature = new byte[]{0x6d, 0x79, 0x2d, 0x61, 0x70, 0x70};
private byte[] apiKey = new byte[]{1a7c, 1x6d, 0x4p, 1x31, 1x5z, 1x69};
PaydiantApplicationConfig.getPaydiantApplicationConfig()
.setupPaydiantApplicationConfig(HOST_URL, PROTOCOL, androidContextInstance, appSignature, apiKey);

Configure optional SDK instance settings

You can run an overloaded method with two optional parameters in lieu of the standard SDK configuration method to set values for supported optional properties.

com.paydiant.android.config.PaydiantApplicationConfig#setupPaydiantApplicationConfig(String hostURL, String protocol, ContextWrapper contextWrapper, byte[] appSignature, byte[] apiKey, paydiantSDKConfigProps, customAppVersionName)
paydiantSDKConfigProps

The paydiantSDKConfigProps parameter allows you to set Boolean properties that specify whether the login password/passcode (PIN)/secret question responses (MFA) shall be encrypted during transmission to the mobile gateway and also whether the secret question responses (MFA) shall be captured with case sensitivity:

- com.paydiant.android.config.PaydiantApplicationConfig.PASSWORD_ENCRYPTION_KEY("paydiant.mobile.sdk.password.hash.enable")
- com.paydiant.android.config.PaydiantApplicationConfig.PASSCODE_ENCRYPTION_KEY("paydiant.mobile.sdk.passcode.hash.enable")
- com.paydiant.android.config.PaydiantApplicationConfig.MFA_ANSWER_ENCRYPTION_KEY("paydiant.mobile.sdk.mfa.hash.enable")
- com.paydiant.android.config.PaydiantApplicationConfig.MFA_CASE_SENSITIVITY_ENCRYPTION_KEY("paydiant.mobile.sdk.mfa.case.sensitivity.enable")

The default value for encryption of the login credentials is FALSE. This means the password, PIN and MFA response are encrypted during transmission.

The default value for MFA response case sensitivity is also FALSE. This means that the server will accept a value of Los Angeles as well as los angeles, regardless of how it was originally entered by the user.

If your environment requires configuration overriding the default value for any of these properties, you need set the alternate value for only the properties to be overridden.

Note: The settings for login credential encryption must match the corresponding settings on the Issuer’s onboarding configuration or login will fail. Consult your Paydiant support representative to verify whether non-default configuration for any other these properties is required for your security environment.

customAppVersionName

The customAppVersionName parameter allows you to set an alternative application version to override Paydiant’s default a.b.c.d.e versioning format. This custom value will supersede the default setting in the AndroidManifest. Define the setting as follows: private String customAppVersionName = "5.10" ` The following code sample shows an example overloaded SDK configuration with the following optional property settings:

  • login password encryption disabled
  • secret password response case-sensitivity enabled
  • passcode and MFA encryption properties omitted, indicating that the default value of TRUE will be observed
  • custom app version set to 5.10 instead of the default 5.10.0.2.a
import com.paydiant.android.config.PaydiantApplicationConfig;
private final String HOST = "";
private final String HOST_URL = HOST + "/";
private final String PROTOCOL = "";
private ContextWrapper androidContextInstance;
private byte[] appSignature = new byte[]{0x6d, 0x79, 0x2d, 0x61, 0x70, 0x70};
private byte[] apiKey = new byte[]{1a7c, 1x6d, 0x4p, 1x31, 1x5z, 1x69};
private Properties sdkConfigProperties = new Properties();
private String customAppVersionName = "<5.10>"
// Disable password encryption and enable MFA case sensitivity:
sdkConfigProperties.put
(com.paydiant.android.config.PaydiantApplicationConfig.PASSWORD_ENCRYPTION_KEY, false
com.paydiant.android.config.PaydiantApplicationConfig.MFA_CASE_SENSITIVITY_KEY, true);

PaydiantApplicationConfig.getPaydiantApplicationConfig().setupPaydiantApplicationConfig(HOST_URL, PROTOCOL, androidContextInstance, appSignature, apiKey, sdkConfigProperties, customAppVersionName);

Enable System Logging

As of SDK version 5.10, Paydiant’s default Logging Utility is automatically initialized by the SDK and the app is no longer required to explicitly initialize SDK logging.

However, the Logging Utility does need to be included as a service in the AndroidManifest file, as shown in the following excerpt:


android:name="com.paydiant.android.ui.service.logging.PaydiantLoggingService"

Configure a custom logging utility implementation

Developers who wish to implement their own custom logging utility can initialize that implementation by setting the custom logging utility interface class:

SDKLoggingHelper.setSDKLoggingUtility(ISDKLoggingUtility)

Refer to Custom Logging Utility for more information about implementing a custom logging utility.

Success and Failure Callbacks

This guide lists the appropriate success and failure callbacks. The developer should use that information to configure the success and failure callbacks to initiate appropriate behavior in the app upon completion of the method.

Other Resources

javadocs