Android SDK - Development Environment Setup

DOCS

Last updated: Aug 15th, 6:03am

Paydiant is now PayPal's White Label Wallet (WLW) Platform.

PayPal's WLW 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 WLW mobile payments platform.

Android SDK Package Contents

The SDK Package for Android development includes the following contents:

WLW 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:

      1compile fileTree(dir: 'libs', include: ['\*.jar']) //add the SDK jar and zxing jar from libs folder
      2compile 'org.springframework.android:spring-android-rest-template:2.0.0.M4'
      3compile 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.8.1'
      4compile 'com.squareup.okhttp3:okhttp:3.4.1'
      5compile 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
      6compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
      7compile 'com.android.support:multidex:1.0.1'
      8compile 'com.google.android.gms:play-services-location:9.2.1'
      9compile '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 WLW Project

    The WLW Platform Android SDK relies on certain Android API configurations and prerequisites, as defined in the AndroidManifest.xml.

    WLW 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:

      1< 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.

        1&lt; ?xml version="1.0" encoding="utf-8"?&gt;
        2&lt; manifest xmlns:android="http://schemas.android.com/apk/res/android"
        3package="com.paydiant.android" android:versionCode="1000" ndroid:versionName="1.0.0"&gt;
        4&lt; uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11"/&gt;
        5&lt; uses-feature android:name="android.hardware.camera.autofocus" /&gt;
        6&lt; uses-permission android:name="android.permission.INTERNET" /&gt;
        7&lt; uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
        8&lt; uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
        9&lt; uses-permission android:name="android.permission.CAMERA" /&gt;
        10&lt; uses-permission android:name="android.permission.FLASHLIGHT" /&gt;
        11&lt; uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
        12&lt; application android:label="@string/app_name" android:icon="@drawable/icon"
        13android:name=".common.ApplicationContext"
        14android:theme="@android:style/Theme.NoTitleBar"
        15android:hardwareAccelerated="true"&gt;
        16&lt; !-- List of Activities --&gt;
        17&lt; activity android:name=".MainActivity"
        18android:label="@string/app_name" android:screenOrientation="portrait"&gt;
        19&lt; intent-filter&gt;
        20 ...
        21&lt; /intent-filter&gt;
        22&lt; /activity&gt;
        23&lt; activity ....&gt;
        24...
        25&lt; /activity&gt;
        26&lt; !-- List of services --&gt;
        27&lt; service android:name= "com.paydiant.android.ui.service.logging.PaydiantLoggingService" /&gt;
        28&lt; service .... /&gt;
        29 ...
        30 ...
        31&lt; service .... /&gt;
        32&lt; /application&gt;
        33&lt; /manifest&gt;

        Configure Your Development Environment with the WLW Service

        Define the following environment variables for your development environment:

        VariableDescription
        HostThe Host name where the mobile gateway resides, for example, demo.paydiant.com
        ProtocolThe protocol to be used when calling the mobile gateway. For this version it is https.
        Host URL PathThe 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 SignatureThe identification of your application’s signature verification, in byte format, which can easily be converted to the string value.
        API KeyThe 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 WLW SDK using the following method:

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

          The following code sample shows a sample SDK configuration.

            1private static final String HOST_IP = "<hostname>";
            2private static final String HOST_URL = HOST_IP + "<URL Suffix>";
            3private static final String PROTOCOL = "<protocol>";
            4private ContextWrapper androidContextInstance;
            5private byte[] appSignature = new byte[]{0x6d, 0x79, 0x2d, 0x61, 0x70, 0x70};
            6private byte[] apiKey = new byte[]{1a7c, 1x6d, 0x4p, 1x31, 1x5z, 1x69};
            7PaydiantApplicationConfig.getPaydiantApplicationConfig()
            8.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.

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

              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:

                1* com.paydiant.android.config.PaydiantApplicationConfig.PASSWORD_ENCRYPTION_KEY("paydiant.mobile.sdk.password.hash.enable")
                2* com.paydiant.android.config.PaydiantApplicationConfig.PASSCODE_ENCRYPTION_KEY("paydiant.mobile.sdk.passcode.hash.enable")
                3* com.paydiant.android.config.PaydiantApplicationConfig.MFA_ANSWER_ENCRYPTION_KEY("paydiant.mobile.sdk.mfa.hash.enable")
                4* 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.

                customAppVersionName

                The customAppVersionName parameter allows you to set an alternative application version to override WLW’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
                  1import com.paydiant.android.config.PaydiantApplicationConfig;
                  2private final String HOST = "<hostname>";
                  3private final String HOST_URL = HOST + "/<URLSuffix>";
                  4private final String PROTOCOL = "<protocol>";
                  5private ContextWrapper androidContextInstance;
                  6private byte[] appSignature = new byte[]{0x6d, 0x79, 0x2d, 0x61, 0x70, 0x70};
                  7private byte[] apiKey = new byte[]{1a7c, 1x6d, 0x4p, 1x31, 1x5z, 1x69};
                  8private Properties sdkConfigProperties = new Properties();
                  9private String customAppVersionName = "<5.10>"
                  10// Disable password encryption and enable MFA case sensitivity:
                  11sdkConfigProperties.put
                  12(com.paydiant.android.config.PaydiantApplicationConfig.PASSWORD_ENCRYPTION_KEY, false
                  13com.paydiant.android.config.PaydiantApplicationConfig.MFA_CASE_SENSITIVITY_KEY, true);
                  14
                  15PaydiantApplicationConfig.getPaydiantApplicationConfig().setupPaydiantApplicationConfig(HOST_URL, PROTOCOL, androidContextInstance, appSignature, apiKey, sdkConfigProperties, customAppVersionName);

                  Enable System Logging

                  As of SDK version 5.10, WLW’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:

                    1<service>
                    2android:name="com.paydiant.android.ui.service.logging.PaydiantLoggingService"
                    3</service>

                    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:

                      1SDKLoggingHelper.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.