I suspect this is not device specific but rather Android version specific, i.e. something that changed between M and N. I did a similar test with a TC51 N device and dispatchKeyEvent did not fire.
DataWedge is not sending KeyEvents for each of the individual characters in the barcode but is only designed to work with text fields which is why this behaviour was never tested.
I spoke with the team & they are keen to understand the issue better (even if it is just better documenting exactly how the behaviour is supposed to work),
- If you could please provide your source code it would help understanding the specific issue
- If you could please let us know why the Intent mechanism was not acceptable for your application? Typically I would expect applications that required DataWedge input without text fields to use Intents.
Thank you Darryn
I've used Keyboard output thus far mostly because it was just easier. I was really struggling to get intents working, as the guides seem a bit over-complicated for an app that *merely needs to scan barcodes*. I found them hard to follow and when I tried following them to the letter, I ended up with an app that just wasn't receiving the data.
Whereas accepting keyboard output by overriding dispatchKeyEvent was very simple.
I'd prefer using an intent to be honest but it's just been a very frustrating experience.
It's a webview app. The source code links:
It does sound like Intents are the best way forward in your case. I have a basic sample on my github to receive a scan via an intent (GitHub - darryncampbell/DataWedge-Intent-Example-1 ) if that helps. I'll probably write a blog around it at some point as it's a question we frequently get.
I followed your example code and got intents working. Now able to send the barcode intents into my webview. It's actually exceedingly simple to get accepting intents working, I don't understand why the guides are so complicated.
My name is Eddie Correia, and I'm responsible for the DataWedge docs on Techdocs. I'm glad you were able to get DataWedge working the way you wanted, and I'm sorry that our docs seemed complicated and/or weren't helpful.
If I might, I'd like to request that you provide some specific feedback on where and how we might improve or simplify the docs. Our goal is to make DataWedge guides easier for developers to use, and direct input from developers is an invaluable part of that.
Thanks and regards,
Every time I tried to search for an example, I ended up on this one or one very similar. This exmaple included a 'softscan triggering' tutorial which is (if I understand what it is) unnecessary for my basic needs, and when I tried following the '
onNewIntent' code, I always ended up unable to get the data in my app.
I came into the docs thinking what I wanted was literally the most basic possible thing you could do with a datawedge, but I couldn't find anything that simple in the tutorials or docs anywhere.
1 of 1 people found this helpful
Thanks Sam. We will add a simpler tutorial. Feel free to send additional suggestions. -EC
Will you update me when you've made that guide?