Aadhaar QR Scan SDK - Android Native

Enables users to scan the compliant QR code inside their existing Aadhaar card through your custom Android app.

Minimum Requirements

  • minSdkVersion 21
  • AndroidX

Getting Started

Add the following lines in your root build.gradle

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" 
        }
    }
}

Add following lines in your module level build.gradle

android {
    ...
    compileOptions {
       sourceCompatibility = 1.8
       targetCompatibility = 1.8
    }
}
dependencies {
    ....
implementation 'com.github.Bureau-Inc:aadhaar-qr-scanner-sdk:0.0.1
'
}

Initializing the SDK and the response returned from the SDK

var scanner = BureauQRScanner.Builder().setCredentialID("YOUR_CREDENTIAL_ID").setDocType(DocType.AADHAAR).setPrompt("YOUR_STRING_TO_DISPLAY").setActivity(this@YourActivity).setEnvironment(ENV_PRODUCTION).build()
scanner.scanQR(object: ScannedDataCallback{
override fun onResult(data : ScannnedData){
data.merchantId
data.referenceId
data.requestId
data.isSuccess
data.errorType
data.errorDescription
}
})

Notes

  1. CredentialId is a mandatory field and should not be empty
  2. The referenceId from the callback should be recorded.
  3. Error types are predefined enumerations which will be explained below
  4. Error Description contains additional error information.
  5. setPrompt() function is used to set your custom text when scanning is in progress.
  6. The SDK never requests permission but will give a callback if it was not handled by the primary application

SDK Error Types

  1. CAMERA_PERMISSION_REFUSED,
  2. SCAN_CANCELLED,
  3. SCAN_DATA_ERROR,
  4. API_ERROR

Backend API to fetch the details

Link to backend API