On This Page
Configuring the PAX All-in-One Android SDK
Use the information in this section to configure the PAX All-in-One Android SDK.
Configure the Project settings.gradle File
settings.gradle
FileFollow this step to configure your project's
settings.gradle
file.- Add the repository to your project'ssettings.gradlefile.dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { mavenCentral() google() exclusiveContent { forRepository { maven { setUrl("https://repo.visa.com/mpos-releases/") } } filter { includeGroup("io.payworks") } } } }
Configure the Project build.gradle File
build.gradle
FileFollow this step to configure your project's
build.gradle
file.- Add the Kotlin Gradle plug-in, which is required to use this solution. Note that Kotlin version 2.1 or later and Android Gradle version 8.2 or later are required.plugins { id("com.android.application") version "8.2.0" apply false id("org.jetbrains.kotlin.android") version "2.1.0" apply false }
Configure the Module build.gradle File
build.gradle
FileFollow these steps to configure your module
build.gradle
file.- In the Android section, add these exclusion rules to your module'sbuild.gradlefile.android { ... packaging { resources { excludes.add("META-INF/*") excludes.add("LICENSE.txt") excludes.add("asm-license.txt") } } }
- In order for the app to support Java 17 features, you must set the compatibility levels.android { ... compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = "17" } }
- The PAX All-in-One Android Solution library publishes a release build type only. The debug build type is not available, so set thematchingFallbacksfield value torelease.android { ... buildTypes { ... debug { matchingFallbacks.apply { clear() add("release") } } } }
- Stay current with the latest SDK. The SDK repository is continuously updated to make available the six latest versions. When a new version is released, the oldest is removed and can no longer be used for new application builds. Establish a regular process for updating to the newest available SDK version to avoid potential build failures and to ensure that your application runs with the latest features, performance enhancements, and security updates.Add the required Default UI and PAX libraries to the dependencies section of your module'sbuild.gradlefile.dependencies { ... // This is the Default UI dependency implementation("io.payworks:paybutton-android:2.111.0") // This is the PAX dependency implementation("io.payworks:mpos.android.accessories.pax:2.111.0") }
Update the AndroidManifest.xml File
AndroidManifest.xml
FileTo support a large heap size and ensure the necessary permissions for the Default UI, update your
AndroidManifest.xml
file. Enabling a larger heap is essential
for scenarios where terminal updates require the handling and transfer of large
volumes of data.Follow these steps to update your
AndroidManifest.xml
file.- Set theandroid:allowBackupattribute tofalseand theandroid:largeHeapattribute totrue.<application ... android:allowBackup="false" android:largeHeap="true" > ... </application>
- Enable the needed permissions for the Default UI and PAX.<manifest ... > ... <!-- Needed for Default UI ! --> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <!-- Needed for PAX integrations ! --> <uses-permission android:name="com.pax.permission.ICC"/> <uses-permission android:name="com.pax.permission.PICC"/> <uses-permission android:name="com.pax.permission.MAGCARD"/> <uses-permission android:name="com.pax.permission.PED"/> ... </manifest>
Configure ProGuard Rules to Enable Obfuscation
Follow these steps to configure ProGuard rules that enable obfuscation.
- To enable obfuscation for any of your build types, define the setting in the relevantbuild.gradlefile for your app.buildTypes { release { isMinifyEnabled = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } }
- If you are using ProGuard as an obfuscation tool in your app, add these rules to theproguard-rules.profile.# Jackson -keep class com.fasterxml.** { *; } -dontwarn com.fasterxml.** # Bolts -keep class bolts.** { *; } -dontwarn bolts.** # Couchbase -keep class com.couchbase.** { *; } -dontwarn com.couchbase.** # OkHttp -keepattributes Signature -keepattributes *Annotation* -dontwarn com.squareup.okhttp.** -keep class com.squareup.okhttp.* { *; } -dontwarn okio.** # Otto -keepclassmembers class ** { @com.squareup.otto.Subscribe public *; @com.squareup.otto.Produce public *; } # Acceptance Devices -keep class io.mpos.** { *; } -dontwarn io.mpos.** #PAX -dontwarn com.pax.** -keep class com.pax.** { *; }