Initialise scanner parameters in Android via sendBroadcast

R Remy Lavergne 3 years ago
5 1 0

Hi everybody,

I develop an Android / Kotlin app using scanner via DataWedge. All things works fine. When app is launched, a profile is created, with right parameters, via a sendBroadcast.
And, I made the same thing to change scanner settings, specially the "aim_type". By default, its value is "Trigger", and I'm trying to change it programatically on "Press & Release", or "Continuous reading". Via DataWedge, no problem. But the application will be install on many devices, and it should be automatic (like profile).

I'm stuck since many hours.

The code I use to do that :

private fun setScannerParameters() {// MAIN BUNDLE PROPERTIES   val bMain = Bundle()   bMain.putString("PROFILE_NAME", "My Awesome App")   bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST")   bMain.putString("PROFILE_ENABLED", "true")   // PLUGIN_CONFIG BUNDLE PROPERTIES   val bConfig = Bundle()   bConfig.putString("PLUGIN_NAME", "BARCODE")   bConfig.putString("RESET_CONFIG", "true")   // PARAM_LIST BUNDLE PROPERTIES   val bParams = Bundle()   bParams.putString("aim_mode", "on")   bParams.putString("aim_type", "3")   // bParams.putInt("aim_timer", 5000)   // NEST THE BUNDLE "bParams" WITHIN THE BUNDLE "bConfig"   bConfig.putBundle("PARAM_LIST", bParams)   // THEN NEST THE "bConfig" BUNDLE WITHIN THE MAIN BUNDLE "bMain"   bMain.putBundle("PLUGIN_CONFIG", bConfig)   val i = Intent()   i.action = "com.symbol.datawedge.api.ACTION"   i.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain)   this.sendBroadcast(i)}
The scanner settings on my custom profile never change.

Do you have a idea please ?

Thank you in advance

Please register or login to post a reply

1 Replies

V Vedsatx Saddvv

Hi Remy,

You are the first person to ask about Kotlin development for Zebra devices - I am curious how much interest there is in the community for additional Kotlin resources for our devices so I put together the following sample which I believe you may find useful: GitHub - darryncampbell/DataWedgeKotlin: Demo app to show how to access Zebra's DataWedge with Kotlin .  It does not show modification of the trigger mode but does allow the user to modify the illumination mode and picklist mode so hopefully that will point you in the right direction.

Thanks,
Darryn.

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