Skip to main content

Installation

Issuer Pay functionality is provided by MTP SDK. It is recommended to use Android Studio and Gradle to build the project. MTP SDK already includes dependency for Google Play services. See Configure for HMS to build applications for devices which don't support Google Play Services and relies on Huawei Mobile Services (HMS) instead.

Gradle Configuration

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

Environments

  • test - test environment
  • prod - production environment

Example

build.gradle
repositories {
maven {
url 'https://nexus.ext.meawallet.com/repository/<repository>'

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

dependencies {
...
debugImplementation 'com.meawallet:mtp-<issuer>-<environment>:<version>-debug'
releaseImplementation 'com.meawallet:mtp-<issuer>-<environment>:<version>'

// dependencies if HMS supported SDK is used
debugImplementation 'com.meawallet:mtp-<issuer>-hms-<environment>:<version>-debug'
releaseImplementation 'com.meawallet:mtp-<issuer>-hms-<environment>:<version>'
...
}
  • <issuer-repository-group> - dedicated location on Nexus Repository
  • <user> - dedicated User for Nexus Repository
  • <password> - dedicated Password for Nexus Repository
  • <issuer> - issuer name
  • hms - mobile services provider - omitted in case of Google Play Services, present in case of Huawei Mobile Services
  • <environment> - test or prod environment
  • <version> - version of the SDK, see Changelog.
  • -debug - use for debugging, prints MTP SDK logs to Android Logcat.

App Manifest

AndroidManifest.xml file should specify a set of permissions to use the required functionality, for example, NFC and Firebase Cloud Messaging (FCM) or HMS Push Kit.

A special marker tools:overrideLibrary can be used with uses-sdk declaration to override importing a library with a minimum Android SDK version that is more recent than app's minimum Android SDK version. Without this marker manifest merger fails. The marker allows users to select which libraries can be imported ignoring the minimum Android SDK version.

info

Android app auto-backup functionality should be disabled in manifest. Due to security requirements SDK does not allow to recover internal secure storage from backup.

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://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"

android:allowBackup="false"
android:fullBackupContent="false"
android:fullBackupOnly="false">
<!--Disable application data auto-backup -->

...

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

<!-- should be added if HMS supported SDK is configured and used -->
<service android:name=".receivers.MyHmsListenerService" android:exported="false">
<intent-filter>
<action android:name="com.huawei.push.action.MESSAGING_EVENT"/>
</intent-filter>
</service>

...

</application>
</manifest>

MTP SDK uses the following permissions and features which are merged with the app's AndroidManifest.xml:

<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

Applications with a lot of functionality, many classes and using several libraries might 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:<version>'.
  2. Select 'Project' view for your project structure.
  3. Expand 'External Libraries'.
  4. After sync you should see mtp-javadoc-<version>-javadoc library. To look up path where jar file was downloaded, expand mtp-javadoc-<version>-javadoc, 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-<issuer>-<environment>-<version> and select 'Library Properties...'.
  6. Click the '+' icon, paste the path looked up in step 4. and select the mtp-javadoc-<version>-javadoc.jar file.

Quick documentation lookup in Android Studio:

  • Control + Q (Windows/Linux)
  • Control + J (Mac)