Alaqan Mini SDK
for Android
Integrate palm vein biometric authentication into your Android applications with our secure, easy-to-use SDK.
Introduction
The Alaqan Mini SDK enables Android applications to integrate palm vein biometric authentication using the Alaqan Mini hardware device. The SDK provides a secure, easy-to-use interface for user registration and identification through contactless palm recognition technology.
High Security
Multi-spectral imaging with liveness detection for enterprise-grade security.
Fast Recognition
Sub-second identification performance for seamless user experience.
Easy Integration
Simple API with comprehensive callbacks and clear documentation.
Contactless
Hygienic palm vein recognition without physical contact.
Use Cases
- Point of Sale (POS) authentication
- Banking and financial services
- Access control systems
- Time and attendance tracking
- Identity verification
Requirements
Hardware
| Component | Requirement |
|---|---|
| Device | Alaqan Mini Palm Scanner |
| Connection | USB Type-C |
| Host Device | Android device with OTG support |
Software
| Component | Requirement |
|---|---|
| Android SDK | Minimum API Level 24 (Android 7.0 Nougat) |
| Target SDK | API Level 31 (Android 12) recommended |
| Architecture | arm64-v8a, armeabi-v7a |
Network
- Active internet connection required for SDK operations
- Minimum bandwidth: 1 Mbps recommended
Installation
Add the SDK to Your Project
Add the Alaqan Mini SDK AAR file to your project's libs directory:
app/
├── libs/
│ └── alaqan-mini-sdk-1.0.0.aar
├── src/
└── build.gradle
Configure Gradle
Add the following to your app-level build.gradle:
android {
defaultConfig {
minSdk 24
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a'
}
}
}
dependencies {
implementation files('libs/alaqan-mini-sdk-1.0.0.aar')
}
Configure USB Device Filter
Create res/xml/device_filter.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<usb-device vendor-id="17992" product-id="65280" />
</resources>
Update AndroidManifest.xml
Add the required permissions and USB configuration:
<manifest>
<uses-feature android:name="android.hardware.usb.host" android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>
</application>
</manifest>
Quick Start
Here's a minimal example to get you started with the Alaqan Mini SDK:
class MainActivity : AppCompatActivity(), AlaqanMiniListener {
private lateinit var sdk: AlaqanMiniSDK
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
sdk = AlaqanMiniSDK.getInstance()
val errorCode = sdk.initialize(this, "YOUR_API_KEY")
if (errorCode != 0) { Log.e("Alaqan", "Init failed: $errorCode"); return }
sdk.setListener(this)
}
override fun onResume() { super.onResume(); sdk.connect() }
override fun onPause() { super.onPause(); sdk.disconnect() }
override fun onDestroy() { super.onDestroy(); sdk.destroy() }
override fun onDeviceConnected() {
Log.d("Alaqan", "Device connected: ${sdk.serialNumber}")
}
override fun onIdentifyFinish(result: IdentifyResult) {
when (result.status) {
IdentifyStatus.SUCCESS -> Log.d("Alaqan", "Identified: ${result.userId}")
IdentifyStatus.NOT_FOUND -> Log.d("Alaqan", "Not recognized")
}
}
}
SDK Architecture
Lifecycle Management
The SDK follows Android lifecycle best practices. All callbacks are delivered on the main (UI) thread.
| App State | Recommended SDK Action |
|---|---|
onCreate() | initialize() |
onResume() | connect() |
onPause() | disconnect() |
onDestroy() | destroy() |
API Reference
Initialization
initialize()
Initializes the SDK with the application context and API credentials.
fun initialize(context: Context, apiKey: String): Int
Returns: Int — Error code (0 if successful)
| Code | Description |
|---|---|
| 0 | Initialization successful |
| 4001 | No internet connection |
| 6001 | Invalid API key |
| 6002 | API key expired |
| 6003 | License expired |
Connection Management
connect()
Initiates connection to the Alaqan Mini device.
fun connect(): Boolean
disconnect()
Disconnects from the Alaqan Mini device.
fun disconnect()
isConnected
val isConnected: Boolean
Device Information
val serialNumber: String? // e.g., "GX4TYQWH3D"
val firmwareVersion: String? // e.g., "1.2.3"
Registration
startRegister()
Starts the palm registration process for a new user. The SDK captures 3 palm images.
fun startRegister(): Boolean
Callbacks: onRegisterProgress(), onCaptureFeedback(), onRegisterFinish()
stopRegister()
fun stopRegister()
Identification
startIdentify()
Starts the palm identification process.
fun startIdentify(): Boolean
Callbacks: onCaptureFeedback(), onIdentifyFinish()
stopIdentify()
fun stopIdentify()
Configuration
setTimeout()
fun setTimeout(operationType: OperationType, timeoutMs: Long)
| Operation | Default Timeout |
|---|---|
REGISTRATION | 30,000 ms |
IDENTIFICATION | 15,000 ms |
Callbacks & Listeners
interface AlaqanMiniListener {
fun onDeviceConnected()
fun onDeviceDisconnected()
fun onRegisterProgress(progress: RegisterProgress)
fun onRegisterFinish(result: RegisterResult)
fun onIdentifyFinish(result: IdentifyResult)
fun onCaptureFeedback(feedback: CaptureFeedback)
fun onError(error: AlaqanError)
}
Data Models
data class RegisterResult(
val status: RegisterStatus, // SUCCESS, DUPLICATE, FAILED, CANCELLED, TIMEOUT
val userId: String?,
val errorCode: Int?,
val errorMessage: String?
)
data class IdentifyResult(
val status: IdentifyStatus, // SUCCESS, NOT_FOUND, FAILED, CANCELLED, TIMEOUT
val userId: String?,
val confidence: Float?, // 0.0-1.0
val errorCode: Int?,
val errorMessage: String?
)
data class CaptureFeedback(
val status: CaptureStatus,
val guidance: CaptureGuidance?, // MOVE_CLOSER, MOVE_FARTHER, CENTER_PALM, etc.
val qualityScore: Float
)
Error Codes
Connection (1000-1099)
| Code | Constant | Description |
|---|---|---|
| 1001 | ERROR_DEVICE_NOT_FOUND | Device not detected |
| 1002 | ERROR_USB_PERMISSION_DENIED | USB permission not granted |
| 1003 | ERROR_CONNECTION_FAILED | Failed to connect |
| 1004 | ERROR_DEVICE_DISCONNECTED | Device disconnected |
| 1005 | ERROR_DEVICE_BUSY | Device busy |
Registration (2000-2099)
| Code | Constant | Description |
|---|---|---|
| 2001 | ERROR_REGISTRATION_IN_PROGRESS | Already running |
| 2002 | ERROR_CAPTURE_FAILED | Capture failed |
| 2003 | ERROR_QUALITY_TOO_LOW | Quality insufficient |
| 2004 | ERROR_DUPLICATE_PALM | Already registered |
| 2005 | ERROR_REGISTRATION_TIMEOUT | Timed out |
| 2006 | ERROR_REGISTRATION_FAILED | Failed |
Identification (3000-3099)
| Code | Constant | Description |
|---|---|---|
| 3001 | ERROR_IDENTIFICATION_IN_PROGRESS | Already running |
| 3002 | ERROR_CAPTURE_FAILED | Capture failed |
| 3003 | ERROR_QUALITY_TOO_LOW | Quality insufficient |
| 3004 | ERROR_IDENTIFICATION_TIMEOUT | Timed out |
| 3005 | ERROR_IDENTIFICATION_FAILED | Failed |
Network (4000-4099)
| Code | Constant | Description |
|---|---|---|
| 4001 | ERROR_NETWORK_UNAVAILABLE | No internet |
| 4002 | ERROR_SERVICE_UNAVAILABLE | Service unavailable |
| 4003 | ERROR_REQUEST_TIMEOUT | Request timed out |
License (6000-6099)
| Code | Constant | Description |
|---|---|---|
| 6001 | ERROR_API_KEY_INVALID | Invalid API key |
| 6002 | ERROR_API_KEY_EXPIRED | API key expired |
| 6003 | ERROR_LICENSE_EXPIRED | License expired |
| 6004 | ERROR_QUOTA_EXCEEDED | Quota exceeded |
General (9000-9099)
| Code | Constant | Description |
|---|---|---|
| 9001 | ERROR_SDK_NOT_INITIALIZED | Not initialized |
| 9002 | ERROR_INVALID_PARAMETER | Invalid parameter |
| 9003 | ERROR_OPERATION_CANCELLED | Cancelled |
| 9999 | ERROR_UNKNOWN | Unknown error |
Best Practices
Always check isConnected before starting registration or identification operations.
Error Handling
override fun onError(error: AlaqanError) {
when (error.code) {
in 1000..1099 -> handleConnectionError(error)
in 2000..2099 -> handleRegistrationError(error)
in 3000..3099 -> handleIdentificationError(error)
in 4000..4099 -> handleNetworkError(error)
in 6000..6099 -> handleLicenseError(error)
else -> handleGeneralError(error)
}
}
Troubleshooting
Device Not Detected
Symptoms: onDeviceConnected() never called, ERROR_DEVICE_NOT_FOUND
- Verify Alaqan Mini is properly connected
- Check USB OTG is enabled on the Android device
- Verify
device_filter.xmlcontains correct VID/PID values - Try a different USB cable
USB Permission Denied
Symptoms: ERROR_USB_PERMISSION_DENIED
- Ensure USB permission dialog is shown and accepted
- Check that your Activity handles USB intents correctly
- Clear app data and try again
SDK Initialization Fails
Symptoms: initialize() returns non-zero
- Verify API key is correct
- Ensure active internet connection
- Check that API key has not expired
- Check logcat for detailed error messages
Sample Implementation
Contact Alaqan support for a complete sample project with full source code.
Support
Technical Support
support@alaqan.com
Business Inquiries
sales@alaqan.com
Include: Error code, steps to reproduce, device serial number, and SDK version.
