Set IDV Database
API: setIDVDatabaseID
📌 Overview
The setIDVDatabaseID
API is used to set a specific document database in the REL-ID IDV SDK. It must be used before initiating document scan operation, when useDefaultDatabase
is set to false
either from the Gateway Manager or via the setIDVConfig
API. On invocation, the SDK downloads the selected database (if not already downloaded) and uses it for document scanning.
⚙️ Behavior
- Must be called before document scan initialization if not using default database.
- The selected database is downloaded in the background.
- Progress of download is reported via
onDatabaseDownloadProgress
event. - If the provided database ID is invalid or not in the config, a sync error will be returned.
🧑💻 Method Signatures
Platform | Signature |
---|---|
React Native | RdnaClient.setIDVDatabaseID(databaseID, callback) |
Flutter | rdna.setIDVDatabaseID(databaseID) |
Cordova | com.uniken.rdnaplugin.RdnaClient.setIDVDatabaseID(successCallback, errorCallback, [databaseID]) |
Native Android | RDNAError setIDVDatabaseID(String databaseID) |
Native iOS | - (RDNAError *)setIDVDatabaseID:(NSString *)databaseID; |
📥 Parameters
Name | Type | Description |
---|---|---|
databaseID | string | Unique identifier of the target document database (e.g., "India", "Jordan", "FullDB") |
📤 Response
Returns a standard RDNAError
JSON object:
{
"shortErrorCode": 0,
"longErrorCode": 0,
"errorString": "Success"
}
📄 Code Snippets
React Native
const dbId = "India";
RdnaClient.setIDVDatabaseID(dbId, (result) => {
if (result.shortErrorCode === 0) {
console.log("Database ID set successfully");
} else {
console.error("Error:", result.errorString);
}
});
Flutter
const dbId = "India";
rdna.setIDVDatabaseID(dbId).then((result) {
if (result["shortErrorCode"] == 0) {
print("Database set successfully");
} else {
print("Error: ${result["errorString"]}");
}
});
Cordova
const dbId = "India";
com.uniken.rdnaplugin.RdnaClient.setIDVDatabaseID(
function(result) {
console.log("Success:", result);
},
function(error) {
console.error("Error:", error);
},
[dbId]
);
Native Android
String dbId = "India";
RDNA.RDNAError result = rdnaClient.setIDVDatabaseID(dbId);
if (result.getShortErrorCode() == 0) {
Log.d("IDV", "Database set successfully");
} else {
Log.e("IDV", result.getErrorString());
}
Native iOS
NSString *dbId = @"India";
RDNAError *result = [self.rdnaClient setIDVDatabaseID:dbId];
if (result.shortErrorCode == 0) {
NSLog(@"Database set successfully");
} else {
NSLog(@"Error: %@", result.errorString);
}
Event: onDatabaseDownloadProgress
📌 Overview
onDatabaseDownloadProgress
is an event callback triggered by the REL-ID IDV SDK to provide real-time progress updates while a database is being downloaded to the device.
🔁 Triggered By
- Automatically invoked when
setIDVDatabaseID()
is called and the database file needs to be downloaded.
📥 Parameters (JSON Payload)
{
"downloadProgress": 0,
"databaseID": "test"
}
Field | Type | Description |
---|---|---|
downloadProgress | int | Progress status (see RDNAIDVDownloadStatus enum) |
databaseID | string | ID of the database currently being downloaded |
RDNAIDVDownloadStatus Enum Values
Value | Status |
---|---|
0 | Download Started |
1 | In Progress |
2 | Completed |
3 | Failed |
💻 Platform-Specific Listener Setup
React Native
EventEmitter.addListener('onDatabaseDownloadProgress', (response) => {
console.log('Progress:', response.downloadProgress);
console.log('Database:', response.databaseID);
});
Flutter
rdna.on('onDatabaseDownloadProgress', (response) {
print("Progress: ${response['downloadProgress']}, Database: ${response['databaseID']}");
});
Cordova
document.addEventListener('onDatabaseDownloadProgress', function(response) {
console.log("Progress:", response.downloadProgress);
console.log("Database ID:", response.databaseID);
});
Native Android
@Override
public void onDatabaseDownloadProgress(RDNAIDVDownloadStatus status, String databaseID) {
Log.d("DBDownload", "Progress: " + status + ", DB: " + databaseID);
}
Native iOS
- (void)onDatabaseDownloadProgress:(RDNAIDVDownloadStatus)status databaseID:(NSString *)databaseID {
NSLog(@"Progress: %ld, Database ID: %@", (long)status, databaseID);
}
📚 RDNAIDVDownloadStatus Enum Details
Enum Constant | Value | Description |
---|---|---|
RDNA_IDV_STARTED | 0 | Database download started |
RDNA_IDV_INPROGRESS | 1 | Database download is in progress |
RDNA_IDV_COMPLETED | 2 | Database download completed |
RDNA_IDV_FAILED | 3 | Database download failed |
These values can be used to interpret the downloadProgress
field in the onDatabaseDownloadProgress
event.
Updated 3 months ago