FILTER BY TAG

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

Follow this step to configure your project's
settings.gradle
file.
  1. Add the repository to your project's
    settings.gradle
    file.
    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

Follow this step to configure your project's
build.gradle
file.
  1. 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

Follow these steps to configure your module
build.gradle
file.
  1. In the Android section, add these exclusion rules to your module's
    build.gradle
    file.
    android {     ...     packaging {         resources {             excludes.add("META-INF/*")             excludes.add("LICENSE.txt")             excludes.add("asm-license.txt")         }     } }
  2. 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"     } }
  3. The PAX All-in-One Android Solution library publishes a release build type only. The debug build type is not available, so set the
    matchingFallbacks
    field value to
    release
    .
    android {     ...     buildTypes {         ...         debug {             matchingFallbacks.apply {                 clear()                 add("release")             }         }     } }
  4. 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's
    build.gradle
    file.
    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

To 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.
  1. Set the
    android:allowBackup
    attribute to
    false
    and the
    android:largeHeap
    attribute to
    true
    .
    <application     ...     android:allowBackup="false"     android:largeHeap="true"     >     ... </application>
  2. 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.
  1. To enable obfuscation for any of your build types, define the setting in the relevant
    build.gradle
    file for your app.
    buildTypes {     release {         isMinifyEnabled = true         proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")     } }
  2. If you are using ProGuard as an obfuscation tool in your app, add these rules to the
    proguard-rules.pro
    file.
    # 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.** { *; }