Database

This page covers the description of databases

Contents

Introduction

A database stores the documents' data. It's mandatory to have db.dat file if type of the document, Visual zone data should be recognized. If MRZ, Barcode recognition or image cropping is performed, there is no need to have the database (db.dat file) inside the application.

Adding a database to the application

Manually

This option is the only option for applications that need to work offline.

Go to the following link licensing.regulaforensics.com. Select the "Databases" page. Download a database provided there. After this, you need to create assets and Regula folders in your project and add the db.dat file to the app/src/main/assets/Regula folder (for Android), and to the desired project's target, no matter where to place it in the project (for iOS).

So, once you build and run the project, it will be inside the application and processed by the SDK.

Using the prepareDatabase method

This option requires having the Internet connection as a database will be downloaded from our server over the Internet.

DocumentReader.prepareDatabase("Full", (respond) => {
console.log(respond);
},
(error) => {
console.log(error);
});

Note: "Full" - the ID of the database that has to be downloaded.

When operation is completed successfully, a database will be added to resources of the application.

If the database isn't compatible with the SDK or it is not in the app at all and you use this option, it will be downloaded. Once the downloaded database becomes incompatible with that version of the SDK that you use or you remove it from the app, it will be downloaded again as soon as this function is invoked.

Using the runAutoUpdate method

This option requires having the Internet connection as a database will be downloaded from our server over the Internet.

DocumentReader.runAutoUpdate("Full", (respond) => {
console.log(respond);
},
(error) => {
console.log(error);
});

Note: "Full" - the ID of the database that has to be downloaded.

When operation is completed successfully, a database will be added to resources of the application.

If the database isn't compatible with the SDK or it is not in the app at all and you use this option, it will be downloaded. This method downloads each update of the database if a newer version is live on our server, otherwise, nothing will be downloaded/updated.

Removing a database from the application

Allows to remove the added database:

DocumentReader.removeDatabase((respond) => {
console.log(respond);
},
(error) => {
console.log(error);
});

Cancelling database update

Allows to cancel database update:

DocumentReader.cancelDBUpdate((respond) => {
console.log(respond);
},
(error) => {
console.log(error);
});

FAQ

I don't want to use the database that includes all documents of the world. Is it possible to create a custom database with certain documents?

Yes, sure. Please reach out to us at [email protected] if you need a custom database, and tell us document(s) of which country(ies) it should contain.

What is the difference between the prepareDatabase and runAutoUpdate methods?

The difference between prepareDatabase and runAutoUpdate is that the first one won't download a new version of the database until the current is incompatible with the SDK, whereas the runAutoUpdate method will download the new version if there is such one on our server.

Which option should I use if my application needs to work offline?

Choose the Manual option. This is the only option if the app needs to work offline.

When should I invoke a method that adds a database to the app?

Before the initialization process is started.

Which option(s) should I use so the app's package size is not increased?

You need to choose either the prepareDatabase or runAutoUpdate method.