i modified erel's recent Google Code Scanner class
www.b4x.com
it includes the barcode type detected, which may be of interest if multiple formats have been enabled. the result returned to b4xmainpage includes the type.
replace or modify the original class (in situ) and replace the button1_click sub in b4xmainpage with this:
class is attached.
[class] Google Code Scanner - no permission, very simple to use, barcode scanning
This solution is based on ML Kit (https://developers.google.com/ml-kit/vision/barcode-scanning/code-scanner). Instructions: 1. Add to main module: #AdditionalJar: com.google.android.gms:play-services-code-scanner #MultiDex: True 2. Add to manifest editor: CreateResourceFromFile(Macro...
it includes the barcode type detected, which may be of interest if multiple formats have been enabled. the result returned to b4xmainpage includes the type.
replace or modify the original class (in situ) and replace the button1_click sub in b4xmainpage with this:
B4X:
Dim formats As List = Array(Scanner.FORMAT_ALL_FORMATS) 'For better performance pass the specific formats needed.
Wait For (Scanner.Scan(formats)) Complete (Result As ScannerResult)
If Result.Success Then
MsgboxAsync(Result.format & ": " & Result.Value, "Your scan:")
wait for msgbox_result(res As Int)
End If
class is attached.