Scanner Reader SDK
Prerequisites
-
The host application should be listed on DvStore
-
iPOSpays-powered Dejavoo terminal
-
Login credential to iPOSpays (opens in a new tab)
For Sandbox (UAT):
Users should be onboarded on the iPOSpays sandbox (UAT) environment as a merchant and have a valid TPN.
For Production (Live):
Users should be onboarded on the iPOSpays production environment as a merchant and have a valid TPN.
If you do not have a TPN, contact your ISO or devsupport@dejavoo.io.
Sample Source code
Downloading the Scanner Reader SDK
-
Locate the Peripheral_v1.0.aar file provided with your Scanner Reader kit.
-
Copy the Peripheral_v1.0.aar file to your project directory.
Configuring Gradle Dependencies
Open your module-level build.gradle file and add the following inside the dependencies block:
implementation files "libs/Peripheral_v1.0.aar"Synchronizing Gradle
-
In Android Studio, click Sync Project with Gradle Files
-
This ensures the SDK and dependencies are properly loaded into your project
Accessing the Scanner
Follow the steps below to initialize and use the scanner:
-
Place the
.aarfile inside thelibsfolder of your project -
Add the dependency in the app-level
build.gradlefile:
implementation files 'libs/Peripheral_v1.0.aar'Scanner Initialization
Use the following code to initialize the scanner. After initialization, configure callbacks to handle scan success and failure.
private lateinit var scannerActivity: ScannerActivity
if (Build.MODEL == "P18") {
scannerActivity = ScannerActivity(this, iscanResult, SCAN_TIMEOUT)
} else {
scannerActivity = ScannerActivity(iscanResult, SCAN_TIMEOUT)
}
private const val SCAN_TIMEOUT = 30000 Callback Handling
Implement the callback interface to handle scan responses:
val iscanResult = object : IScannerResult {
override fun onSuccess(result: String) {
// Successful scan result
}
override fun onFailure(errorMessage: String) {
// Error handling
}
}Start Scanning
Use the following code to begin scanning:
scannerActivity.startScan()Stop Scanning
Use the following code to stop the scanner:
scannerActivity.stopScan()Response
Example scan result:
result: P17B4250908000566