Installation

It is recommended to use Android Studio and gradle to build the project. Issuer Pay library already includes dependency for Google Play services.

Gradle Configuration

Issuer Pay library is added to the project as a dependency. Issuer Pay library is hosted in a private Maven repository, so you need to configure build.gradle by setting the assigned URL and credentials.

Environments (library flavors):

  • test – test (staging) environment

  • prod – production environment

				
					repositories {
    maven {
        url 'https://nexus-developer.meawallet.com/content/groups/mtp-<user>-group'

        credentials {
            username '<user>'
            password '<password>'
        }
    }
}

dependencies {
    ...
    implementation 'com.meawallet:mtp-<user>-<environment>:<version>'
    ...
}				
			

Example

Debug version:

				
					implementation 'com.meawallet:mtp-mea-test:<version>-debug'				
			

Release version:

				
					implementation 'com.meawallet:mtp-mea-test:<version>'				
			

App Manifest

The AndroidManifest.xml file should specify a set of permissions to use the required functionality, for example, NFC and Firebase Messaging.

A special marker tools:overrideLibrary can be used with uses-sdk declaration to override importing a library which minimum SDK version is more recent than that application’s minimum SDK version. Without such a marker, the manifest merger will fail. The marker will allow users to select which libraries can be imported ignoring the minimum SDK version.

				
					<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="https://schemas.android.com/apk/res/android"
    xmlns:tools="https://schemas.android.com/tools"
    package="com.company.app">

    <uses-sdk android:minSdkVersion="19"
              tools:overrideLibrary="com.meawallet.mtp"/>

    <uses-feature android:name="android.hardware.nfc" android:required="false"/>
    <uses-feature android:name="android.hardware.nfc.hce" android:required="false"/>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.NFC"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>

    <application
        android:name="android.support.multidex.MultiDexApplication"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"

        <!--Disable application data Auto Backup-->
        android:allowBackup="false"
        android:fullBackupContent="false"
        android:fullBackupOnly="false">

        ...

        <service android:name=".receivers.MyFcmListenerService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>

        ...

    </application>
</manifest>				
			

Issuer Pay library is using these permissions for the library which are merged with the application manifest file:

				
					<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.NFC"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>

<uses-feature android:name="android.hardware.nfc" android:required="false"/>				
			

MultiDex Support

It is likely that quite big applications using several libraries hit 65k method limit. Google Play services library alone has 20k+ methods. In this case there might be an exception when building the project:

				
					AGPBI: {"kind":"SIMPLE","text":"UNEXPECTED TOP-LEVEL EXCEPTION:","position":{},"original":"UNEXPECTED TOP-LEVEL EXCEPTION:"}
AGPBI: {"kind":"SIMPLE","text":"com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536", ...				
			

Applications exceeding 65k method limit should use MultiDex support: Configure Apps with Over 64K Methods

Attaching Javadocs in Android Studio

  1. Add gradle dependency to app compile 'com.meawallet:mtp-javadoc:x.x.x'.
  2. Select ‘Project’ view for your project structure.
  3. Expand ‘External Libraries’.
  4. After sync you should see there mtp-javadoc-x.x.x-javadoc library. To look up path where jar file was downloaded, expand mtp-javadoc-x.x.x, press right click on jar file and select ‘Reveal in Finder'(Mac)/’Show in Explorer'(Windows/Linux)
  5. To add Javadocs to the MTP library, go again to ‘External Libraries’ in Android studio, right-click mtp-mea-test-x.x.x and select ‘Library Properties…’.
  6. Click the ‘+’ icon, paste the path looked up in step 4. and select the mtp-javadoc-x.x.x-javadoc.jar file.

Quick documentation lookup in Android Studio:

  • Control + Q (Windows/Linux)
  • Control + J (Mac)
On this page