Shows how to use the scanner library in an android project
To use the library the following in the build.gradle(project)
repositories {
google()
jcenter()
maven { url'https://jitpack.io' }
}
Then add the dependancy
implementation'com.github.erickogi:Idscanner:v1.0.0'In the activity you plan to use the idscanner, start the scannining activity
startActivityForResult(newIntent(MainActivity.this, CaptureActivity.class), 1001);
Implement onActivityResult to get the kipande object.
@OverrideprotectedvoidonActivityResult(intrequestCode, intresultCode, @NullableIntentdata) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==1001){
if(resultCode== Activity.RESULT_OK){
results.setText("MY D____"+newGson().toJson(data));
Kipandekipande=((Kipande)data.getParcelableExtra("Data") );
results.setText("MY D____"+newGson().toJson(data));
}
}
}
Make sure to add camera perissions to your manifest
<uses-permissionandroid:name="android.permission.CAMERA" />
<uses-featureandroid:name="android.hardware.camera" />