I'm trying to send barcode data using dataWedge on a WS50. I'm working on an app in Kotlin.
My receiver is registered, but the intent isn't being delivered. The logCat I placed in the receiver have never been triggered, even after I scan a barcode. Below are some code snippets and screenshots of my profile. The profile is loading because I am able to change device settings (screen brightness, for example.)
Barcode Receiver
class BarcodeReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
Log.d("BarcodeReceiver", "onReceive triggered")
val action = intent.action
if (action != null && action == "com.example.zonepick.SCAN") {
val extras = intent.extras
if (extras != null && extras.containsKey("com.symbol.datawedge.data_string")) {
val barcodeData = extras.getString("com.symbol.datawedge.data_string")
Log.d("BarcodeReceiver", barcodeData.toString())
}
}
}
}
Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<queries>
<package android:name="com.symbol.emdk.emdkservice" />
</queries>
<uses-permission android:name="com.symbol.emdk.permission.EMDK" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:usesPermissionFlags="neverForLocation" tools:targetApi="s" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:ignore="CoarseFineLocation" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:name="android.hardware.type.watch"/>
<application
android:launchMode="singleTop"
android:name=".ZonePickApplication"
android:usesCleartextTraffic="true"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ZonePick"
tools:targetApi="31">
<uses-library android:name="com.symbol.emdk"/>
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.ZonePick"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".BarcodeReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.example.zonepick.SCAN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>
Registering the receiver (This is in a composable loaded in the MainActivity
DisposableEffect(Unit) {
val barcodeReceiver = BarcodeReceiver()
val intentFilter = IntentFilter("com.example.zonepick.SCAN")
Log.d("Home", "Registering receiver")
context.registerReceiver(barcodeReceiver, intentFilter)
onDispose {
context.unregisterReceiver(barcodeReceiver)
Log.d("Home", "Unregistering receiver")
}
}
The Profile:
4 Replies
I'm having the same issue with trying to get the WS50 to output barcode data. The same application and broadcast receiver is working on the TC52, but not the WS50. The scan button works, and I have a camera preview showing up, which beeps when a barcode is seen, but no data is ever sent.
Dave, what application are you using to view the profile in those last 4 screenshots? I've been trying to verify that my profile is correct, but the WS50 doesn't allow me to see the profile details within the DataWedge app, and the StageNow application on Windows doesn't seem to be able to open the exported datawedge.db file (it's only able to open .zip and .xml).
When I create the profile, I get "SUCCESS", so I assume everything is fine.
This is how I'm building my profile Bundle:
And I'm creating the Intent in another class:
A Quick Question:
Have you referred to the TechDoc Datawedge article regarding the WS50?
https://techdocs.zebra.com/datawedge/13-0/guide/programmers-guides/ws50/
There is also a Demo that goes with that for the WS50 (Truck Loading Demo) here:
https://techdocs.zebra.com/ws50/guide/demo/truck-loading/
I would expect that with the cut down version of Android that the WS50 operates with - that EMDK may not function as expected.
( EDMK has been suggested to developers to migrate to Datawedge.)
Thanks for the response Sean. The truck loading demo does work for me on the WS50, but the code provided does not include the profile creation step.
How can I compare my configuration with dwprofile_truckloadingdemo.db or validate that my configuration is setting the required values correctly? I noticed that I can open dwprofile_truckloadingdemo.db in an SQLite viewer, but that's really cumbersome.
Hi Kyle.
As much as SQLite viewer allows you to see the data, Try to use Datawedge to view the config instead if you have a Zebra Android device (Like a TC52 or an MC33.)
You can import the "truckloading_demo" profile onto these platforms and use Datawedge to look at the config.
Similarly - when you make a change to your profile "programmatically" - you can check on this with Datawedge.
*(A good example of this is using DataCapture1 on a Zebra Android Device - uncheck all 4 barcode decoders, set the setting, and quit the app, go into Datawedge app, and open the "DWDatacapture1" profile and look at the scanner settings - and the "Decoders" menu and see the 4 types that are now disabled. )*