To use our SDK on Android please follow these simple steps to integrate our SDK into your Android project:
Import the barkoder module like it's shown on the picture
Keep in mind that path in source directory should reference to the barcoder folder that contains both barkoder.aar and build.gradle, not directly to the barkoder.aar file
In your app's build gradle file add the following dependency
implementation project(path: ':barkoder')
Add the following code to the layout.xml of the activity/fragment where you want the scanner to be shown
<com.barkoder.BarkoderView
android:id="@+id/bkdView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Create barkoder config per your needs or from some of our templates
bkdView.config = BarkoderConfig(this, "LICENSE_KEY") {
Log.i("LicenseInfo", it.message)
}
BarkoderHelper.applyConfigSettingsFromTemplate(
this,
bkdView.config,
BarkoderConfigTemplate.INDUSTRIAL_1D,
null
)
Implement BarkoderResultCallback interface where you will receive scanned results
class MainActivity : AppCompatActivity(), BarkoderResultCallback {
....
override fun scanningFinished(results: Array<Barkoder.Result>, thumbnails: Array<Bitmap>, imageResult: Bitmap?) {
Log.i("Scanned result", results[0].textualData)
}
}
bkdView.startScanning(this)
Find out more: