Android Question Built in barcode scanner

nibbo

Active Member
Licensed User
Hi all

We have acquired some Wepoy s96 android devices with built in barcode scanners, proper ones i.e. not using the camera.
I can use the scanner in keyboard mode but in complicated apps it is not easy to keep the focus on an edit text so I would rather try to capture the data in either serial or using intents or something, anything but keyboard mode.

I have the full blown SDK and API with all documentation but it is all java based and I know diddly about that, I have looked at wrappers but, whoa, that's even more confusing to me.

Attached is a screen shot of the settings screen which implies I could probably use an intent but after a lot of searching and fiddling it would appear that I know diddly about that also...

Tried to add an intent based on one thread
B4X:
AddReceiverText(BarcodeScanned,
                <intent-filter>
                <action android:name="android.intent.ACTION_DECODE_DATA" />
                </intent-filter>
but this did not seem to pass it on to the service; tried similar with AddActivityText but activity not started either.

Any help greatly appreciated.

Thanks
Nibbo
 

Attachments

Last edited:

nibbo

Active Member
Licensed User
In case anyone else has this problem, I added the intent category and now the service start is called.

B4X:
AddReceiverText(CodeScanned,
                <intent-filter>
                <action android:name="android.intent.ACTION_DECODE_DATA" />
                <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>)
 

Cassie

Member
Licensed User
In case anyone else has this problem, I added the intent category and now the service start is called.

B4X:
AddReceiverText(CodeScanned,
                <intent-filter>
                <action android:name="android.intent.ACTION_DECODE_DATA" />
                <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>)
Do you have any sample codes... Thanks
 

nibbo

Active Member
Licensed User
Do you have any sample codes... Thanks
Sure..

Add a service module to your project which reflects the receiver name in the AddReceiverText manifest entry.
In my example it is CodeScanned.
I start this service in the 'parent' activity as it did not seem to invoke Service_Start without it.

If you look at the image attached to the first post you will see the intent name and the string name that will contain the result, in my case barcode_string.

In the service starting code block do something like:

B4X:
Sub Service_Start (StartingIntent As Intent)
    '    check a string has been returned   
    If StartingIntent.HasExtra("barcode_string") Then
        '    get the scanned barcode
        Dim sCode As String = StartingIntent.GetExtra("barcode_string")
        Log(sCode)
       '    pass the scanned code back to the activity
       CallSubDelayed2(ActivityName, "SubName", sCode)
    End If
End Sub
Hope this helps but please ask again if you need anything else.
 

Cassie

Member
Licensed User
Thanks a lot ... Check this out later in my tablet I bought and it has a built-in RFID reader, QRCode reader and a built in Finger print scanner ... I have the SDK of it but it is written in Java ...
 

Cassie

Member
Licensed User
Anyone interested in SDK for wrapper I can send you the SDK in java for RFID reader, QRCode and Fingerprint.
 
Top