Database

This page covers the description of databases

Database stores the documents' data. It's mandatory to have db.dat file if type of the document, OCR zone information should be recognized. If MRZ, Barcode recognition or image cropping are used, there is no need to have the db.dat file.

After db.dat is added, it'll be unpacked and a few new files will be created.

The options to get the db.dat file are presented below.

Adding database manually

You can manually add database to the project. First of all, follow the next link licensing.regulaforensics.com, select page "Databases" and download db.dat file. After this you need to create assets and Regula folders in your project and add db.dat file to app/src/main/assets/Regula folder.

Adding database using prepareDatabase method

To reduce your package size database (db.dat file) can be obtained from the network. In order to download db.dat file you should know its identifier, all database identifiers you can find on https://licensing.regulaforensics.com.

DocumentReader.Instance().prepareDatabase(MainActivity.this, "Full", new DocumentReader.DocumentReaderPrepareCompletion() {
    @Override  
    public void onPrepareProgressChanged(int progress) {  
        // getting progress
    }  

    @Override  
    public void onPrepareCompleted(boolean status, String error) {  
        // database was prepared
    }  
});

When operation is completed successfully, db.dat file will get to resources in the same way as if you add it manually. This operation should be run before initialization process.

Adding database using runAutoUpdate method

For getting always the latest version of database you can run autoupdate function:

DocumentReader.Instance().runAutoUpdate(MainActivity.this, "Full", new DocumentReader.DocumentReaderPrepareCompletion() {
    @Override
    public void onPrepareProgressChanged(int progress) {  
        // getting progress
    }  

    @Override
    public void onPrepareCompleted(boolean status, String error) {  
        // database was prepared
    }  
});

When operation is completed successfully, db.dat file will get to resources after update and will be used in next initialization.

Last updated