Build on Android

Learn how to build an SDK payment solution for Android POS terminal devices.

Technical Overview

  • The SDK is distributed as an .aar

  • The package name is Sunmi-firstdata_v0.0.1_release.aar

Getting started

To start:

  • Add the obtained aar file to your Android Studio project, for example into the app module libs folder; and register the .aar in the app's build.gradle

  • The following .aar / libraries are required for the integration

    • Sunmi-firstdata_v0.0.1_release.aar

    • LaineyUI-release.aar

    • PayLib-release-2.0.07.aar

Requirements and limitations

  • Your application minSdkVersion is API 24 (Android 7) or later.

  • Your application targetSdkVersion is API 33 (Android 13) or earlier.

  • Your application compileSdkVersion is 33.

  • Your application uses AndroidX or enables Jetifier in gradle.properties.

android{ useLibrary ("org.apache.http.legacy") } packagingOptions { resources.excludes.add("META-INF/*") }
  • Add the below-mentioned plugins to build.gradle plugins section

plugins{ alias(libs.plugins.android.application) alias(libs.plugins.jetbrains.kotlin.android) kotlin("kapt") }
  • Add the below-mentioned dependencies to build.gradle dependencies section

Android Based Dependency implementation(libs.androidx.core.ktx) implementation(libs.androidx.appcompat) implementation(libs.material) implementation(libs.androidx.activity) implementation(libs.androidx.constraintlayout) testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) // Dependencies for other Functionalities implementation( "androidx.viewpager2:viewpager2:1.1.0-beta01") implementation ("com.tbuonomo.andrui:viewpagerdotsindicator:4.1.2") implementation ("androidx.lifecycle:lifecycle-livedata-ktx:2.4.0") implementation ("androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0") implementation ("androidx.navigation:navigation-fragment-ktx:2.3.5") implementation ("androidx.legacy:legacy-support-v4:1.0.0") implementation ("com.google.code.gson:gson:2.8.8") // - - ViewModel and LiveData var lifecycle_version = "2.6.0-alpha02" var arch_version = "2.1.0" implementation ("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version") implementation ("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version") implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version") // - - Kotlin Coroutines var coroutines_version = "1.3.7" implementation ("androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version") implementation ("androidx.lifecycle:lifecycle-extensions:$arch_version") implementation ("com.alibaba:fastjson:1.1.71.android") implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version") implementation ("com.github.igortrncic.dotted-progress-bar:library:1.0.0") implementation ("com.jakewharton.threetenabp:threetenabp:1.2.1") // Dependencies for other Functionalities implementation ("com.jakewharton.threetenabp:threetenabp:1.2.1") implementation ("com.tencent:mmkv:1.0.19") implementation("com.tencent.bugly:crashreport:3.2.33") implementation ("com.sunmi:printerlibrary:1.0.9") implementation ("org.greenrobot:greendao:3.3.0") implementation ("com.squareup.okhttp3:okhttp:4.8.0") implementation ("com.squareup.okhttp3:logging-interceptor:4.8.0") implementation("commons-codec:commons-codec:1.15") implementation("com.github.igortrncic.dotted-progress-bar:library:1.0.0") implementation ("javax.xml.stream:stax-api:1.0-2") implementation ("com.fasterxml:aalto-xml:1.0.0") implementation ("com.fasterxml.jackson.core:jackson-databind:2.9.0") implementation ("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.0") coreLibraryDesugaring ("com.android.tools:desugar_jdk_libs:1.1.5") implementation ("org.jetbrains:annotations:15.0") implementation("jakarta.xml.bind:jakarta.xml.bind-api:2.3.2") implementation ("com.google.code.gson:gson:2.8.8") implementation("io.reactivex:rxandroid:1.2.1") implementation("io.reactivex.rxjava2:rxandroid:2.0.1") implementation("io.reactivex.rxjava2:rxjava:2.1.8") implementation ("com.squareup.retrofit2:retrofit:2.9.0") implementation ("com.squareup.retrofit2:adapter-rxjava:2.3.0") implementation ("com.squareup.retrofit2:converter-gson:2.9.0") implementation ("com.squareup.retrofit2:converter-scalars:2.0.0") implementation("androidx.room:room-runtime:2.6.1") kapt("androidx.room:room-compiler:2.6.1") implementation("androidx.room:room-ktx:2.6.1") // lib reference api files('libs/LaineyUI-release.aar') api files('libs/PayLib-release-2.0.07.aar') api files('libs/Sunmi-firstdata_v0.0.1_release.aar')
  • Add the below-mentioned dependency to settings.gradle plugins section

Manifest & Permissions

Add below-mentioned permissions inside Manifest.xml file.

Additionally, within the Applications section of your Manifest.xml, insert these two lines of code to grant storage permission.

User Permissions in Launcher Activity

The following permissions are necessary to proceed with the application. Insert the code below in the onCreate() method of the activity.