I needed an embedded scanner when I was developing, and I just looked for information online and most of them I found are talking about using "Intent" to do it but I want an embedeed one. However, I found this Create Barcode Scanner For Android Using Kotlin, Part 2, it saved my life.
- Adding library dependency
- Adding compileOptions and kotlinOptions
- Setting camera permission
- Editing UI layout
- Setting CaptureManager and decode callback
- Editing custom scanner layout
- Setting it to the original layou
- Adding a button to UI layout
- Adding a state variable in activity
- Adding a funcation to change state and available of flashlight
- Setting vibrate permission
- Adding a function to vibrate
- Calling the funcation in the decode callback