1. Android SDK
2. gradle >= 8.0.2
3. Java version 17(Recomended)
DCNFC_android is available through Jitpack. To install it, simply add the following line to your projects build.gradle file:
- Add Source repo to Podfile
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
- Add dependency to the app level build.gradle file.
dependencies {
implementation 'com.github.omkardatachecker:DCNFC_android:1.2'
}
You need to import following modules
import com.example.dcnfclib.DCNFCLib;
import com.example.dcnfclib.model.Constants;
import com.example.dcnfclib.model.EDocument;
Work flow of this library is as follows
-
Read MRZ of the Document first: To read MRZ, create a field in the activity class as follows;
private DCNFCLib dcnfcLib; }
-
Inside onCreate() method, please initialize above variable as follows.
dcnfcLib = new DCNFCLib(this, this);
here first parameter is context or AppcompatActivity and secod parameter is Result Listner.
-
After the above step s, impement the listener methods to receive the scanned document data. as follows
public class MainActivity extends AppCompatActivity implements DCNFCLib.DCNFCLibResultListnerClient {
following are the listner methods.
public void onSuccess(EDocument eDocument) { Log.d("MainActivity", eDocument.getPersonDetails().getName()); } @Override public void onFailure(Constants.ERROR_CODE error) { Log.d("Error", error.name()); }
Here result is of type EDocument.