Tencent Palm Mobile-Side (SDK) API Documentation (v2.3.0)
The mobile interfaces differ between the Max and Standard versions. Use the tabs below to switch and view the corresponding version.
- Max
- Standard
The Tencent Palm Mobile Manager SDK provides a complete mobile palmprint biometric identification solution, supporting three modes: Registration, Verification, and Recognition. It bundles prebuilt UI screens and powerful AI algorithms to simplify development and allow your application to easily integrate comprehensive palmprint biometric capabilities.
Core Modules
The SDK consists of two core modules: the Manager Module and the Capture Module.
Manager Module
User Management Center, primarily responsible for managing palmprint information, such as: user enrollment flow and management of user palmprint information.
- User Management - Automatically queries/creates users and displays palm enrollment status (Enrolled / Not Enrolled / Pre-enrolled).
- Business Flow - Supports three modes: Registration, Recognition (1:N), and Verification (1:1).
- UI Interactions - Displays operation guidance, result handling, error prompts, and retries.
- Result Handling - Receives the capture result and automatically reports the recognition/verification record. (Note: The corresponding scene SN must be configured as
PalmMobileManageron the Palm management platform for record reporting to be supported.) - Result Callback - Only calls back to your application on critical errors (Token invalid, gateway authentication failed) or when the user exits.
Capture Module
Palm information capture, primarily responsible for the algorithm portion, such as: palmprint capture and registration/verification/recognition.
- Camera Capture - Launches the camera and provides a real-time preview.
- AI Processing - Built-in algorithms for palm detection, quality assessment, and liveness action judgment.
- Interactive Guidance - Guides the user through actions such as "open your palm" and "make a fist".
- Data Reporting - Encrypts captured data and uploads it to the server; optionally uploads the capture video.
Features
- Multiple modes: Supports Registration, Verification, and Recognition modes, covering a full range of business needs.
- Cross-platform: Provides out-of-the-box SDKs for Android, iOS, and Flutter.
- Optimized AI algorithms: The SDK directly integrates high-performance detection & alignment, liveness judgment, quality control, and action-judgment algorithms.
- Modular UI components: Provides complete prebuilt UIs for the manager and capture modules, greatly shortening the development cycle.
- Security-by-design: All palmprint data is automatically encrypted before being transmitted to the server.
Core Concepts
To better understand the difference between this SDK's capture results and device-side usage, please review the differences between the feature libraries below:
- Single-factor (Palm print) feature library
- Description: Records only single-factor palm print information. Because a phone camera cannot capture the palm vein, this SDK only captures single-factor palm print information.
- Bimodal (Palm print + Palm vein) feature library
- Description: Records both palm print and palm vein information. This is the high-security standard used for enrollment on professional devices.
Workflow
Note: If you only use the Capture Module (in which case the user will not be created automatically by the Manager Module), your server must first call the
CreateUserAPI of the Tencent PalmAI Platform OpenAPI to create the user, and then proceed with the following steps.
1. Obtain a User Token
Your server must first request an AccessToken bound to the user's UserId from the Tencent PalmAI Platform OpenAPI.
Tip: When calling the [Obtain Access Credentials] API, specify the
GrantTypeasclient_credential_userand provide theUserIdparameter.
- **Manager Module**
Your app --[UserId]--> Your server --[call CreateAccessToken]--> Tencent PalmAI Platform
Your app <--[AccessToken]-- Your server <--[AccessToken]-- Tencent PalmAI Platform
- **Capture Module**:
Your app --[UserId (not registered)][UserName]--> Your server --[call CreateUser]--> Tencent PalmAI Platform
Your app --[UserId (already registered)]--> Your server --[call CreateAccessToken]--> Tencent PalmAI Platform
Your app <--[AccessToken]-- Your server <--[AccessToken]-- Tencent PalmAI Platform
2. Launch the SDK
Our backend service is split into two parts: the Palm Application Platform and the Palm Algorithm Platform. The SDK provides two corresponding modules to connect to them:
| SDK Module | Backend | Description |
|---|---|---|
| Manager Module | Palm Application Platform | Provides the complete palmprint management UI. Entered from the management page; after page interactions, the SDK transitions to the capture screen and handles the result internally. |
| Capture Module | Palm Algorithm Platform | Jumps directly to the camera capture screen for palmprint capture and algorithm processing. You design your own management pages and handle the result. |
Choose the corresponding module based on your business needs:
- Manager Module: launched with
AccessTokenand the required user information (enableManager = true). - Capture Module: launched with
AccessTokenand the required user information (enableManager = false).
3. Automated Flow
The Manager Module automatically completes the following flow, without any intervention from your application:
- Query the user's enrollment status.
- Display a user-friendly UI and operation prompts.
- Invoke the Capture Module based on the mode (Registration / Recognition / Verification).
- Receive and handle various outcomes from the Capture Module (success, permission issues, network issues, algorithm results, etc.).
- Prompt the user to retry or display the final result.
The Capture Module requires you to handle the result yourself; the code field corresponds to the result codes listed in this document.
4. Receive the Callback
When the user taps back or encounters a critical error, the Manager Module closes and calls back to your application. The Capture Module requires you to handle this yourself.
Development Environment Requirements
To ensure the SDK runs stably and is compatible with your environment, please ensure your development environment meets the following minimum requirements:
| Platform | Requirements |
|---|---|
| Android | ● JDK: 17 or later ● Android Gradle Plugin (AGP): 8.5 or later ● Android Studio: Koala | 2024.1.1 or later (to match the AGP requirement) ● minSdkVersion: 24 ● compileSdkVersion / targetSdkVersion: 34+ |
| iOS | ● Xcode: 16.0 or later ● Minimum Deployment Target: iOS 13.0 |
| Flutter | ● Flutter SDK: 3.25.0 or later |
Integration Steps
SDK package: contact the delivery team to obtain it
The directory structures below are all based on the software package directory structure.
Prerequisite: Obtain the Authorization Certificate
You need to provide us with your application's Android ApplicationId and iOS BundleId so that we can generate and bind the authorization certificate required at runtime by this SDK's algorithms.
Tip: For Demo development. If you are only developing and testing, you may set your application ID to match the wildcard
com.tencent.palm.*(for example,com.tencent.palm.demo). Doing so lets you skip the authorization certificate application step.
Android Integration
-
Import the LocalMavenRepo repository
Copy
Android/repointo your project, e.g.,[YOUR_PROJECT]/app/repo. -
Configure the
app/build.gradlefile// ...repositories {// ... other repositoriesmaven {name = "LocalMavenRepo"url = uri("${projectDir}/repo") // ensure the path is correct}}dependencies {// ... other dependenciesimplementation "com.tencent.palm:PalmMobileManager:0.0.0-dev"} -
Brief invocation example
PalmMobileManager.Params params = new PalmMobileManager.Params.Builder(USER_TOKEN, USER_ID, USER_NAME, USER_PHONE_NO)// Set the mode (optional; default is REGISTRATION)// .setMode(PalmMobileManager.Mode.VERIFICATION)// .setTargetUserId(TARGET_USER_ID)// You can also set your own Tencent PalmAI Platform server configuration.// .setBaseUrl(BASE_URL)// .setAppId(APP_ID)// You can customize HTTP request headers to access the gateway corresponding to your configured BaseUrl (e.g., pass a JWT Token)// .addCustomHeader("Authorization", "YOUR_JWT_TOKEN")// You can choose whether to upload the video//.setEnableVideoUpload(true)// You can choose to launch the Manager Module or the Capture Module// - true: launch the Manager Module (default)// - false: launch the Capture Module// .setEnableManager(true)// You can choose which palm to use during capture (PalmDirection.LEFT / RIGHT / UNSPECIFIED)// .setPalmDirection(PalmDirection.UNSPECIFIED).build();PalmMobileManager.start(this, params, result -> {// TODO: handle the business logic according to result.codeLog.i("PalmMobileManager", result.toString());// When using the Capture Module, you need to analyze the result yourself.// Refer to the code and message mapping in the README; data contains the detailed information of result.}); -
Reference example project
See the
Android/exampleproject.
iOS Integration
-
Import the framework
Drag
iOS/Frameworks/PalmMobileManager.xcframeworkinto your Xcode project, and make sure it is set to "Embed & Sign" under "General" -> "Frameworks, Libraries, and Embedded Content". -
Configure camera permission
In the
Info.plistfile, addPrivacy - Camera Usage Descriptionand fill in a user-visible description. -
Brief invocation example
let params = PalmMobileManagerParams(token: token,userId: userId,userName: userName,phoneNo: phoneNo,)// Set the mode (optional; default is registration)// params.mode = .verification// params.targetUserId = TARGET_USER_ID// You can also set your own Tencent PalmAI Platform server configuration.// params.appId = APP_ID// params.baseUrl = BASE_URL// You can customize HTTP request headers to access the gateway corresponding to your configured BaseUrl (e.g., pass a JWT Token)// params.addCustomHeader(// withKey: "Authorization",// value: "YOUR_JWT_TOKEN"// )// You can choose whether to upload the video//params.enableVideoUpload = true// You can choose to launch the Manager Module or the Capture Module// - true: launch the Manager Module (default)// - false: launch the Capture Module// params.enableManager = true// You can choose which palm to use during capture (.left / .right / .unspecified)// params.palmDirection = .unspecifiedPalmMobileManager.start(from: controller,params: params,completion: { result in// TODO: handle the business logic according to result.codeprint("PalmMobileManager succeed: \(result.code): \(result.message): \(result.data)")// When using the Capture Module, you need to analyze the result yourself.// Refer to the code and message mapping in the README; data contains the detailed information of result.}) -
Reference example project
See the
iOS/exampleproject.
Flutter Integration
-
Import the plugin
Place
flutter/palm_mobile_managerin thepackagesdirectory of your project (create it if it does not exist).[YOUR_FLUTTER_APP]/├── packages/│ └── palm_mobile_manager/ <-- plugin directory├── lib/...└── pubspec.yaml -
Add the dependency
Add a local path dependency in
[YOUR_FLUTTER_APP]/pubspec.yaml:dependencies:flutter:sdk: flutter# ... other dependenciespalm_mobile_manager:path: packages/palm_mobile_managerversion: 0.0.0-dev -
Add the Android LocalMavenRepo path
Add the Maven repository path in
[YOUR_FLUTTER_APP]/android/build.gradle.kts(orbuild.gradle):allprojects {repositories {google()mavenCentral()// add next config to local maven repomaven {url = uri(rootDir.resolve("../packages/palm_mobile_manager/android/repo"))}}} -
Configure iOS camera permission
Add
NSCameraUsageDescriptionin[YOUR_FLUTTER_APP]/iOS/Runner/Info.plist:<key>NSCameraUsageDescription</key><string>Camera permission is required to perform palmprint scanning.</string> -
Brief invocation example
final params = Params(token: _tokenController.text,userId: _userIdController.text,phoneNo: _phoneNoController.text,userName: _userNameController.text,// Set the mode (optional; default is REGISTRATION)// mode: Mode.verification,// targetUserId: TARGET_USER_ID,// You can also set your own Tencent PalmAI Platform server configuration.// appId: APP_ID, // YOUR OWN APP ID// baseUrl: BASE_URL,// You can customize HTTP request headers to access the gateway corresponding to your configured BaseUrl (e.g., pass a JWT Token)// customHeaders: {'Authorization': 'YOUR_JWT_TOKEN'},// You can choose whether to upload the video// enableVideoUpload: true,// You can choose to launch the Manager Module or the Capture Module// - true: launch the Manager Module (default)// - false: launch the Capture Module//enableManager: true,// You can choose which palm to use during capture (PalmDirection.left / right / unspecified)//palmDirection: PalmDirection.unspecified,);Result result;try {result = await _palmMobileManager.start(params);print('Success! Result from native: $result');} catch (e) {result = Result(code: -1, message: e.toString());print('Error! Failed to start: $e');} -
Reference example project
See the
flutter/palm_mobile_manager/exampleproject. -
Opening the example project's iOS project for the first time (important)
example/ios/Pods/,example/ios/Flutter/Generated.xcconfig,.dart_tool/, and similar files are local build artifacts excluded by.gitignoreand are not included in the SDK package or repository. Openingexample/ios/Runner.xcworkspacedirectly in Xcode will produce:Unable to load contents of file list:'/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Release-input-files.xcfilelist'This is standard behavior for a Flutter plugin project (unrelated to the SDK version). Please run the following three steps in order under the
flutter/palm_mobile_manager/directory (pod installdepends on theGenerated.xcconfigproduced by the previous step; the order must not be reversed):flutter pub get # dependencies of the plugin itself(cd example && flutter pub get) # generate .symlinks and ios/Flutter/Generated.xcconfig for example(cd example/ios && pod install) # generate Pods and xcfilelistAfter that, open
example/ios/Runner.xcworkspacein Xcode and it will compile normally.If
pod installreportsUnable to find a specification for ..., the local CocoaPods spec repo is behindPodfile.lock; retry withpod install --repo-update.
API Reference
Params
The configuration parameter object used when launching the SDK.
Tip: When required and optional parameters are passed in at SDK launch, only null and validity checks are performed; otherwise,
code=10001is returned. The integrator should follow the format requirements below; otherwise, network-related errors will be shown to the user in the Manager Module.
Required Parameters
| Parameter | Type | Description |
|---|---|---|
token | String | User identity token, used to authorize this SDK operation. |
userId | String | Unique user identifier. Format requirements: 1-64 characters; only ASCII letters (A-Z, a-z), digits (0-9), hyphens (-), and underscores (_) are supported. Spaces and other whitespace characters are not allowed. |
userName | String | User name. Format requirements: 1-64 characters (Unicode). Cannot consist only of whitespace. Leading and trailing spaces are not allowed in the Name (spaces are allowed between characters). Supports data masking. |
phoneNo | String | User phone number. Format requirements: digits only (4-20 digits for the phone number) with a country code (1-3 digits), e.g., (+86)13800138000. Supports data masking. |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
mode | Mode | REGISTRATION | Business mode. Available values: • REGISTRATION - Registration mode• VERIFICATION - Verification mode (1:1)• RECOGNITION - Recognition mode (1:N) |
targetUserId | String | - | The ID of the target user to be verified. Note: Required in VERIFICATION mode. |
appId | int | 223 | Application ID, provided by the service provider. |
baseUrl | String | https://app.intl.palm.tencent.com | API service address. |
enableVideoUpload | Boolean | true | Whether to upload the capture video. |
enableManager | Boolean | true | Whether to launch the Manager Module. true launches the Manager Module; false launches the Capture Module. |
customHeaders | Map<String, String> | - | Custom HTTP request headers. Used to access the gateway corresponding to your configured BaseUrl (e.g., pass a JWT Token). |
palmDirection | String | unspecified | Which palm to use during capture. Available values: • unspecified - Either palm is acceptable (default)• left - Force use of the left hand• right - Force use of the right hand |
Result
The result object returned via the callback when the SDK exits.
| Property | Type | Description |
|---|---|---|
code | int | Result code. See the callback result code list below. |
message | String | Description; for debugging use only. |
Callback Result Codes
The Manager Module automatically handles most result codes from the Capture Module. Your application only receives callbacks for the following result codes:
| Result Code | Scenario | Recommendation |
|---|---|---|
| 0 | Operation succeeded or user actively returned | No action required. |
| 10001 | Invalid parameters | Verify that the parameters are valid, e.g., whether required fields are empty and whether the BaseUrl is valid. |
| 10012 | Token invalid or expired | Obtain a new Token. |
| 10401 | Gateway authentication failed for the specified BaseUrl | Contact the BaseUrl provider for technical support, or add the JWT authentication information corresponding to your gateway. |
Full Result Code Reference
Note: The Capture Module does not intercept and handle result codes internally. The full result code reference is as follows:
Click to expand and view all result codes
Common Result Codes
| Result Code | Developer Description |
|---|---|
| 0 | Operation succeeded (callback will be triggered) |
| 10000 | Unknown error |
| 10001 | Invalid parameter (callback will be triggered) |
| 10002 | User cancelled the capture operation |
| 10003 | Camera permission denied |
| 10004 | Camera initialization failed |
| 10005 | Unsupported camera preview size |
| 10006 | SDK initialization failed |
| 10007 | SDK runtime error |
| 10008 | Capture timed out (30-second timeout) |
| 10012 | Token invalid or expired (callback will be triggered) |
| 10016 | Authorization certificate verification failed |
| 10017 | Invalid user name format |
| 10018 | Invalid user ID format |
| 10019 | Invalid phone number format |
| 10021 | User name does not exist |
| 10022 | The tenant has disabled user registration |
| 10023 | The phone number already exists under this tenant |
| 10024 | The tenant has disabled palmprint registration |
Registration Mode Result Codes
| Result Code | Developer Description |
|---|---|
| 10100 | Liveness check failed |
| 10101 | Quality check failed |
| 10102 | Liveness video verification failed |
| 10103 | The palm is already registered |
| 10104 | High similarity to an existing user |
Recognition Mode Result Codes
| Result Code | Description |
|---|---|
| 10200 | User not recognized |
Verification Mode Result Codes
| Result Code | Description |
|---|---|
| 10200 | No feature found for the user to be verified |
| 10300 | The user to be verified does not exist |
| 10301 | The user to be verified has no palmprint registered |
| 10302 | The user to be verified has not registered the current palm direction |
Network Result Codes
| Result Code | Description |
|---|---|
| 10401 | Gateway unauthenticated access (callback will be triggered) |
| 10500 | Network error |
Security Warning
Production Environment Security Requirements
Do NOT hardcode SecretId or SecretKey in client code in a production environment!
Doing so exposes your platform account keys to all users. Attackers can use these keys to attack your service, causing severe losses.
Correct approach (production):
- **Manager Module**
Your app --[UserId]--> Your server --[call CreateAccessToken]--> Tencent PalmAI Platform
Your app <--[AccessToken]-- Your server <--[AccessToken]-- Tencent PalmAI Platform
- **Capture Module**:
Your app --[UserId (not registered)][UserName]--> Your server --[call CreateUser]--> Tencent PalmAI Platform
Your app --[UserId (already registered)]--> Your server --[call CreateAccessToken]--> Tencent PalmAI Platform
Your app <--[AccessToken]-- Your server <--[AccessToken]-- Tencent PalmAI Platform
Test Environment Quick Start
Only for local development / internal testing / isolated demo environments; illustrates how to quickly obtain a Token.
/**
* [For testing only] Quickly obtain a Token and launch the SDK
* Warning: In production, the Token must be obtained from your backend server.
*/
private void startForTesting() {
// Initialize OpenApiService
OpenApiService.init(OPEN_API_URL, APP_ID, SECRET_ID, SECRET_KEY);
CreateAccessTokenRequest req = new CreateAccessTokenRequest(USER_ID);
OpenApiService.getInstance().createAccessToken(req, new ApiClient.Callback<CreateAccessTokenResponse>() {
@Override
public void onSuccess(CreateAccessTokenResponse response) {
start(response.accessToken); // Launch the SDK with the Token
}
@Override
public void onFailure(int code, String message) {
Log.e("PalmMobileManager", "Failed to get token: " + code + " - " + message);
}
});
}
Tip:
AppId/BaseUrl/SecretId/SecretKeymust be used in matching pairs. To obtain test credentials, please contact technical support.
Next Steps and Support
- Review the example projects: We strongly recommend that you compile and run the corresponding platform's example project before integration; this will help you quickly understand the SDK's complete invocation flow.
- Obtain technical support: If you encounter any issues during integration, please contact your technical support representative.
Tencent Palm Mobile Manager
The Tencent Palm Mobile Manager SDK provides a complete solution for mobile palm print biometrics, supporting registration mode. It includes pre-built UI interfaces and powerful AI algorithms designed to streamline development, enabling your app to easily integrate comprehensive palm print biometric capabilities.
Core Modules
The SDK consists of two core modules: Management Module and Acquisition Module.
Management Module
User Management Center, responsible for managing palm print information, e.g. the user registration flow and managing users' palm print information.
- User Management — Automatically query/create users; display palm registration status (Registered / Not Registered / Pre-registered).
- Business Flow — Supports Registration mode.
- UI Interaction — Displays operation guidance, processing results, error prompts, and retry options.
- Result Processing — Receives acquisition results.
- Result Callback — Only calls back to your app on critical errors (Token invalid, gateway authentication failed) or user exit.
Acquisition Module
Palm Information Acquisition, responsible for the capture and on-device algorithm pipeline, e.g. capturing the palm print and performing registration.
- Camera Acquisition — Launches the camera and provides a real-time preview.
- AI Processing — Built-in algorithms for palm print detection, quality assessment, and liveness action recognition.
- Interactive Guidance — Guides the user through actions such as "open palm" and "make fist".
- Data Upload — Encrypts and uploads captured data to the server; video upload is optional.
Features
- Cross-Platform Support: Provides out-of-the-box SDKs for Android, iOS, and Flutter.
- Optimized AI Algorithms: Integrates high-performance algorithms for detection and alignment, liveness verification, quality control, and action recognition directly within the SDK.
- Modular UI Components: Offers complete, pre-built UI for both the management and acquisition modules, significantly reducing development time.
- Secure by Design: All palm print data is automatically encrypted before being transmitted to the server.
Core Concepts
To better understand the acquisition results of this SDK and how they differ from on-device usage, please be aware of the distinction between the following feature sets:
- [Palm Print] Single-Factor Feature Set
- Description: Records only palm print single-factor information. Because mobile phone cameras cannot capture palm vein data, this SDK only collects palm print single-factor information.
- [Palm Print + Palm Vein] Dual-Factor Feature Set
- Description: Records both palm print and palm vein dual-factor information. This is the high-security standard used for enrollment on professional devices.
Workflow
Note: If you only use the Acquisition Module (users will not be automatically created via the Management Module), please have your server call the
CreateUserAPI from Tencent PalmAI Platform OpenAPI to create users first, then proceed with the following steps.
1. Obtain User Token
Your backend server must first request an AccessToken bound to the user's UserId from Tencent PalmAI Platform OpenAPI.
Note: When calling the [CreateAccessToken] API, you need to specify the
GrantTypeasclient_credential_userand provide theUserIdparameter.
- **Management Module**
Your App --[UserId]--> Your Server --[Call CreateAccessToken]--> Tencent PalmAI Platform
Your App <--[AccessToken]-- Your Server <--[AccessToken]-- Tencent PalmAI Platform
- **Acquisition Module**:
Your App --[UserId (unregistered)][UserName]--> Your Server --[Call CreateUser]--> Tencent PalmAI Platform
Your App --[UserId (registered)]--> Your Server --[Call CreateAccessToken]--> Tencent PalmAI Platform
Your App <--[AccessToken]-- Your Server <--[AccessToken]-- Tencent PalmAI Platform
2. Start the SDK
Our backend services are divided into two parts: the Palm Application Platform and the Palm Algorithm Platform. The SDK provides two corresponding modules to connect to them:
| SDK Module | Backend | Description |
|---|---|---|
| Management Module | Palm Application Platform | Provides a complete palm print management UI. Enters from the management page, then jumps to the acquisition screen after UI interaction. The result is handled internally by the SDK. |
| Acquisition Module | Palm Algorithm Platform | Jumps directly to the camera acquisition screen for palm print capture and algorithm processing. You design the management page and handle the result yourself. |
Choose the corresponding module based on your business needs:
- Management Module: Start with
AccessTokenand required user information (enableManager = true) - Acquisition Module: Start with
AccessTokenand required user information (enableManager = false)
3. Automated Flow
The Management Module automatically completes the following flow without your app's intervention:
- Query user registration status.
- Display friendly UI and operation prompts.
- Invoke the Acquisition Module for registration.
- Receive and process various situations from the Acquisition Module (success, permission issues, network issues, algorithm results, etc.).
- Prompt the user to retry or display the final result.
The Acquisition Module requires you to handle the result yourself. The code field corresponds to the result codes in this document.
4. Receive Callback
When the user clicks back or encounters a critical error, the Management Module closes and calls back to your app. The Acquisition Module requires you to handle it yourself.
Development Environment Requirements
To ensure the stability and compatibility of the SDK, please make sure your development environment meets the following minimum requirements:
| Platform | Requirements |
|---|---|
| Android | ● JDK: 17 or later ● Android Gradle Plugin (AGP): 8.5 or later ● Android Studio: Koala | 2024.1.1 or later (to match AGP requirements) ● minSdkVersion: 24 ● compileSdkVersion / targetSdkVersion: 34+ |
| iOS | ● Xcode: 16.0 or later ● Minimum Deployment Target: iOS 13.0 |
| Flutter | ● Flutter SDK: 3.25.0 or later |
Integration Steps
SDK Package: Please Contact Your Delivery Representative
The following directory structure is based on the SDK package directory structure.
Prerequisite: Obtain Authorization Certificate
You need to provide us with your app's Android ApplicationId and iOS BundleId so that we can generate and bind the authorization certificate required for the SDK's algorithm runtime.
Note: For Demo Development. If you are only developing and testing, you can set your app's ID to a format that matches the
com.tencent.palm.*wildcard (e.g.,com.tencent.palm.demo). This allows you to skip the authorization certificate application step.
Android Integration
-
Import the LocalMavenRepo Repository
Copy the
Android/repodirectory into your project, for example, to[YOUR_PROJECT]/app/repo. -
Configure the
app/build.gradlefile// ...repositories {// ... other repositoriesmaven {name = "LocalMavenRepo"url = uri("${projectDir}/repo") // Ensure the path is correct}}dependencies {// ... other dependenciesimplementation "com.tencent.palm:PalmMobileManager:0.0.0-dev"} -
Brief Usage Example
PalmMobileManager.Params params = new PalmMobileManager.Params.Builder(USER_TOKEN, USER_ID, USER_NAME, USER_PHONE_NO)// You can also set your own Tencent PalmAI Platform server config.// .setBaseUrl(BASE_URL)// .setAppId(APP_ID)// You can customize HTTP request headers to access the gateway corresponding to your configured BaseUrl (e.g., pass JWT Token)// .addCustomHeader("Authorization", "YOUR_JWT_TOKEN")// You can choose whether to upload the video// .setEnableVideoUpload(true)// You can choose to start the Management Module or the Acquisition Module// - true: Start the Management Module (Default)// - false: Start the Acquisition Module// .setEnableManager(true)// Specify which palm to use (PalmDirection.LEFT / RIGHT / UNSPECIFIED)// .setPalmDirection(PalmDirection.UNSPECIFIED).build();PalmMobileManager.start(this, params, result -> {// TODO: Handle business logic based on result.codeLog.i("PalmMobileManager", result.toString());// When using the Acquisition Module, you need to parse the result yourself// Refer to the code and message mapping in this README. The data field contains detailed result information.}); -
Refer to the Example Project
For details, see the
Android/exampleproject.
iOS Integration
-
Import the Framework
Drag
iOS/Frameworks/PalmMobileManager.xcframeworkinto your Xcode project and ensure it is set to "Embed & Sign" under "General" -> "Frameworks, Libraries, and Embedded Content". -
Configure Camera Permissions
In your
Info.plistfile, add thePrivacy - Camera Usage Descriptionkey and provide a user-facing explanation for why camera access is needed. -
Brief Usage Example
let params = PalmMobileManagerParams(token: token,userId: userId,userName: userName,phoneNo: phoneNo,)// You can also set your own Tencent PalmAI Platform server config.// params.appId = APP_ID// params.baseUrl = BASE_URL// You can customize HTTP request headers to access the gateway corresponding to your configured BaseUrl (e.g., pass JWT Token)// params.addCustomHeader(// withKey: "Authorization",// value: "YOUR_JWT_TOKEN"// )// You can choose whether to upload the video// params.enableVideoUpload = true// You can choose to start the Management Module or the Acquisition Module// - true: Start the Management Module (Default)// - false: Start the Acquisition Module// params.enableManager = true// Specify which palm to use (.left / .right / .unspecified)// params.palmDirection = .unspecifiedPalmMobileManager.start(from: controller,params: params,completion: { result in// TODO: Handle business logic based on result.codeprint("PalmMobileManager succeed: \(result.code): \(result.message): \(result.data)")// When using the Acquisition Module, you need to parse the result yourself// Refer to the code and message mapping in this README. The data field contains detailed result information.}) -
Refer to the Example Project
For details, see the
iOS/exampleproject.
Flutter Integration
-
Import the Plugin
Place the
flutter/palm_mobile_managerdirectory into apackagesdirectory within your project (create it if it doesn't exist).[YOUR_FLUTTER_APP]/├── packages/│ └── palm_mobile_manager/ <-- Plugin directory├── lib/...└── pubspec.yaml -
Add the Dependency
In your
[YOUR_FLUTTER_APP]/pubspec.yaml, add a local path dependency:dependencies:flutter:sdk: flutter# ... other dependenciespalm_mobile_manager:path: packages/palm_mobile_managerversion: 0.0.0-dev -
Add Android LocalMavenRepo Path
In your
[YOUR_FLUTTER_APP]/android/build.gradle.kts(orbuild.gradle), add the Maven repository path:allprojects {repositories {google()mavenCentral()// add next config to local maven repomaven {url = uri(rootDir.resolve("../packages/palm_mobile_manager/android/repo"))}}} -
Configure iOS Camera Permissions
In
[YOUR_FLUTTER_APP]/iOS/Runner/Info.plist, addNSCameraUsageDescription:<key>NSCameraUsageDescription</key><string>Camera access is required for palm print scanning.</string> -
Brief Usage Example
final params = Params(token: _tokenController.text,userId: _userIdController.text,phoneNo: _phoneNoController.text,userName: _userNameController.text,// You can also set your own Tencent PalmAI Platform server config.// appId: APP_ID, // YOUR OWN APP ID// baseUrl: BASE_URL,// You can customize HTTP request headers to access the gateway corresponding to your configured BaseUrl (e.g., pass JWT Token)// customHeaders: {'Authorization': 'YOUR_JWT_TOKEN'},// You can choose whether to upload the video// enableVideoUpload: true,// You can choose to start the Management Module or the Acquisition Module// - true: Start the Management Module (Default)// - false: Start the Acquisition Module// enableManager: true,// Specify which palm to use (PalmDirection.left / right / unspecified)// palmDirection: PalmDirection.unspecified,);Result result;try {result = await _palmMobileManager.start(params);print('Success! Result from native: $result');} catch (e) {result = Result(code: -1, message: e.toString());print('Error! Failed to start: $e');} -
Refer to the Example Project
For details, see the
flutter/palm_mobile_manager/exampleproject. -
First-Time Opening of the Example iOS Project (Important)
example/ios/Pods/,example/ios/Flutter/Generated.xcconfig,.dart_tool/, etc. are local build outputs excluded by.gitignoreand are NOT included in the SDK package / repository. Openingexample/ios/Runner.xcworkspacedirectly with Xcode will fail with:Unable to load contents of file list:'/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Release-input-files.xcfilelist'This is the standard behavior of any Flutter plugin project (independent of the SDK version). Run the following three steps under
flutter/palm_mobile_manager/(pod installconsumes theGenerated.xcconfigproduced by the previous step, so the order matters):flutter pub get # plugin dependencies(cd example && flutter pub get) # generates example .symlinks and ios/Flutter/Generated.xcconfig(cd example/ios && pod install) # generates Pods and xcfilelistThen open
example/ios/Runner.xcworkspacewith Xcode and it will build normally.If
pod installfails withUnable to find a specification for ..., your local CocoaPods spec repo is out of sync withPodfile.lock; retry withpod install --repo-update.
API Reference
Params
Configuration object for starting the SDK.
Note: When passing required and optional parameters to start the SDK, only non-null and validity checks are performed; otherwise, code=10001 is returned. Integrators should follow the format requirements below; otherwise, network-related errors will be displayed to users in the Management Module.
Required Parameters
| Parameter | Type | Description |
|---|---|---|
token | String | User identity token for authorizing this SDK operation. |
userId | String | User's unique identifier. Format: 1-64 characters. Only ASCII letters (A-Z, a-z), digits (0-9), hyphens ( -), and underscores (_) are allowed. No spaces or whitespace. |
userName | String | User's name. Format: 1-64 Unicode characters. Cannot consist solely of whitespace. No leading or trailing spaces allowed (spaces between characters are permitted). Supports desensitization. |
phoneNo | String | User's phone number. Format: Numbers only (4-20 digits), including country code (1-3 digits), e.g., (+86)13800138000. Supports desensitization. |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
appId | int | 223 | Application ID, provided by service provider. |
baseUrl | String | https://app.intl.palm.tencent.com | API service address. |
enableVideoUpload | Boolean | true | Whether to upload acquisition video. |
enableManager | Boolean | true | Whether to start the Management Module. When true, starts the Management Module; when false, starts the Acquisition Module. |
customHeaders | Map<String, String> | - | Custom HTTP request headers. Used to access the gateway corresponding to your configured BaseUrl (e.g., pass JWT Token). |
palmDirection | String | unspecified | Which palm to use during acquisition. Options: • unspecified - Either palm is allowed (default)• left - Force left palm• right - Force right palm |
Result
Result object returned via callback when the SDK exits.
| Property | Type | Description |
|---|---|---|
code | int | Result code. See callback result codes below. |
message | String | Descriptive message for debugging only. |
Callback Result Codes
The Management Module automatically handles most results from the Acquisition Module. Your app will only receive callbacks for the following result codes:
| Code | Scenario | Handling Suggestion |
|---|---|---|
| 0 | Operation successful or user manually returns | No action needed |
| 10001 | Invalid parameters | Check if parameters are valid, such as whether required fields are empty, whether BaseUrl is valid, etc. |
| 10012 | Invalid or expired Token | Re-obtain Token |
| 10401 | Gateway authentication failed for specified BaseUrl | Contact the BaseUrl provider for technical support, or add your gateway's JWT authentication information |
Complete Result Code Reference
Note: Acquisition Module does not capture result codes for internal handling. Complete result codes are as follows:
Click to expand all result codes
Common Result Codes
| Code | Developer Notes |
|---|---|
| 0 | Operation successful (will callback) |
| 10000 | Unknown error |
| 10001 | Invalid parameters (will callback) |
| 10002 | User cancelled acquisition operation |
| 10003 | Camera permission denied |
| 10004 | Camera initialization failed |
| 10005 | Unsupported camera preview size |
| 10006 | SDK initialization failed |
| 10007 | SDK runtime error |
| 10008 | Acquisition timeout (30 seconds timeout) |
| 10012 | Invalid or expired Token (will callback) |
| 10016 | Authorization certificate validation failed |
| 10017 | Invalid UserName format |
| 10018 | Invalid UserId format |
| 10019 | Invalid Phone Number format |
| 10021 | UserName does not exist |
| 10022 | Tenant has disabled user registration |
| 10023 | Phone number already exists under the tenant |
| 10024 | Tenant has disabled palm print registration |
Registration Mode Result Codes
| Code | Developer Notes |
|---|---|
| 10100 | Liveness detection failed |
| 10101 | Quality check failed |
| 10102 | Liveness video verification failed |
| 10103 | Palm already registered |
| 10104 | High similarity with existing user |
Network Result Codes
| Code | Description |
|---|---|
| 10401 | Unauthorized gateway access (will callback) |
| 10500 | Network error |
Security Warning
Production Environment Security Requirements
NEVER hardcode SecretId or SecretKey in production client code!
This exposes your platform account credentials to all users, allowing attackers to exploit them and cause severe damage to your services.
Correct Approach (Production):
- **Management Module**
Your App --[UserId]--> Your Server --[Call CreateAccessToken]--> Tencent PalmAI Platform
Your App <--[AccessToken]-- Your Server <--[AccessToken]-- Tencent PalmAI Platform
- **Acquisition Module**:
Your App --[UserId (unregistered)][UserName]--> Your Server --[Call CreateUser]--> Tencent PalmAI Platform
Your App --[UserId (registered)]--> Your Server --[Call CreateAccessToken]--> Tencent PalmAI Platform
Your App <--[AccessToken]-- Your Server <--[AccessToken]-- Tencent PalmAI Platform
Quick Start for Testing Environments
For local development / internal testing / isolated demo environments only. Demonstrates how to quickly obtain a Token:
/**
* [For Testing Only] Quick token fetch and SDK start
* WARNING: In production, tokens MUST come from your backend server
*/
private void startForTesting() {
// Initialize OpenApiService
OpenApiService.init(OPEN_API_URL, APP_ID, SECRET_ID, SECRET_KEY);
CreateAccessTokenRequest req = new CreateAccessTokenRequest(USER_ID);
OpenApiService.getInstance().createAccessToken(req, new ApiClient.Callback<CreateAccessTokenResponse>() {
@Override
public void onSuccess(CreateAccessTokenResponse response) {
start(response.accessToken); // Start SDK with Token
}
@Override
public void onFailure(int code, String message) {
Log.e("PalmMobileManager", "Failed to get token: " + code + " - " + message);
}
});
}
Note:
AppId/BaseUrl/SecretId/SecretKeymust be used as a matching set. Contact technical support for test credentials.
Next Steps & Support
- Review the Example Projects: We strongly recommend that you compile and run the example project for your target platform before integration. This will help you quickly understand the SDK's complete workflow.
- Get Technical Support: If you encounter any issues during integration, please contact your technical support representative.