Android Question Built in barcode scanner

nibbo

Active Member
Licensed User
Longtime 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

  • wepoy.png
    wepoy.png
    124.7 KB · Views: 415
Last edited:

nibbo

Active Member
Licensed User
Longtime 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>)
 
Upvote 0

Cassie

Member
Licensed User
Longtime 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
 
Upvote 0

nibbo

Active Member
Licensed User
Longtime 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.
 
Upvote 0

Cassie

Member
Licensed User
Longtime 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 ...
 
Upvote 0

Cassie

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