Broadcast receiver receives scan payload but no field "com.symbol.datawedge.data_string" is present

// Expert user has replied.
S Stelios Papamichail 8 months ago
63 1 0

I am trying to add support for receiving barcode data in our native Android app using Zebra scanners. After going through the docs and doing the required setup in both, our app and the DataWedge profile, I can successfully receive scan events but the "com.symbol.datawedge.data_string" field is missing.

Here's some more info:

I have declared my broadcast receiver in the AndroidManifest file like so:

        <receiver android:name=".receivers.ZebraBarcodeBroadcastReceiver" android:exported="true">
           <intent-filter>
               <action android:name="com.hermessolutions.lyrawms.ZEBRA_BARCODE_SCAN"/>
           </intent-filter>
       </receiver>

The ZebraBarcodeBroadcastReceiver is defined as follows:

class ZebraBarcodeBroadcastReceiver : BroadcastReceiver() {
   override fun onReceive(cntxt: Context?, intent: Intent?) {
       if(intent?.action == ZebraScannerIntentInfo.ZEBRA_SCAN_INTENT_ACTION) {
           val extras = intent.extras
           val payload = extras?.getString(ZebraScannerIntentInfo.ZEBRA_SCAN_INTENT_BARCODE_EXTRA_KEY)
           Log.d(
               ZebraBarcodeBroadcastReceiver::class.java.simpleName, "Got data $payload" +
                   "")
       }
   }
}

where the broadcast related constants are defined here:

object ZebraScannerIntentInfo {
   const val ZEBRA_SCAN_INTENT_ACTION = "com.hermessolutions.lyrawms.ZEBRA_BARCODE_SCAN"
   const val ZEBRA_SCAN_INTENT_BARCODE_EXTRA_KEY = "com.symbol.datawedge.data_string"
}

I have set up the DataWedge profile for our app according to the docs so that it sends the appropriate intent action to our application upon scanning barcodes and it seems to be working since the broadcast receiver does log the event along with the payload info. The only thing that seems to be missing from the intent bundle is the "data_string" field which is strange since it is probably the most important part. I have of course tried scanning multiple different products but without success. Any ideas on what I may be missing here?

Please Register or Login to post a reply

1 Replies

S Sean Kennedy

Hello Stelios.

Your code seems similar to other code - but my reference source code for this topic is the "BasicIntent1" source code for Android Studio.

The github to find this is here: https://github.com/ZebraDevs/DataWedge-Android-Samples
( You get to this from the Datawedge TechDoc page "Samples" starting here:

https://techdocs.zebra.com/datawedge/13-0/guide/about/
FYI: I always refer to techdocs in a response. )

Basicintent1 is very simple - and the string involved in that sample seems to be "R.string.datawedge_intent_key_data"  which I am unsure if your code above seems to be addressing to get.  ( Please follow the directions in the Sample Code page - it indicates how to create the BasicIntent1 Datawedge profile step-by-step, and you will need this for the app to work as expected.)

 

CONTACT
Can’t find what you’re looking for?