I have been looking for a solution to use dedicated barcode scanners (so, NO camera scanning) connected either through bluetooth or USB (to a docking station) with an Android, iOS (maybe also UWP) tablet or phone device. And to my deep disappointment, it appears impossible to find information that is helping. Most suggestions talk about supporting Android, others about using ZXing library which uses camera to scan meaning it is dead slow to do scanning that way as camera needs to be loaded, then to focus on a barcode in order to scan it. That sometimes takes seconds.
ZXing might be great for individual users, regular phone/tablet user scanning only once in a while. Camera scanning is great that way but for business use, where users maybe scanning one or more items per second, ZXing and in general, camera scanning is not an option.
So, what is left? Based on my experience working with handheld ruggedized device, another option would be vendor SDKs or EMDKs. These are either free or you have to buy them. However, these are currntly available only for Android (Honeywell, Motorola, Intermec, Zebra, all of them support only Android or Xamarin Android. There is no support for Xamarin.Forms, Xamarin.iOS, Xamarin.UWP, not to mention .NET Standard 2, ...) (believe me on this, I have spent a week talking to all these vendors).
How about Nuget packages, PCL libraries, whatever? Well, turns out these are also available only for Android or Xamarin Android. Again dead end.
Then I read somewhere that scanners are just input devices, just like keyboards. Why not treat them as such and simply process key inputs using events such as TextChaned and Completed on an Xamarin.Forms Entry field. This is apparently called keyboard emulation.
This seem to be quite possible. No SDKs or EMDKs needed, no need to deal with 3rd party vendors, updates, being behind the host platform, no need to track different packages for different vendors and waste so much time, no need to bloat size of your app with packages you dont even know what they are doing.
This all makes perfect sense and the only possible dissadvantages of this method I can see are:
- 2 input streams (keyboard and scanner) and how to distinguish btw them
- possible need to configure a scanner
However, I dont see these as a problem and here is why. Scanners can be configured to have a prefix and / or a suffix after every and each scan. That solves 1st possible disadvantage above. But it leads to second - scanners need to be configured to have this suffix and/or prefix. However, if you control the scanners (deliver them to your customers), or if you can request or provide means to your customer to set this scanner configuration, which in my experience is mostly the case, then that is not a problem either.
My question is has anyone done this already?
I havent. I am in process of researching the option and I am thinking to give it a try but I do not see any issue with this idea. I admit, I have seen some saying that keyboard emulation is not good idea but I have also heard others swear into it. While the opposers havent provided any valuable explanation why keyboard emulation is a bad idea, everything I wrote above sounds to me a very logical and reasonable explanation why it is a great idea.
Please share your thoughts or solution if you have it and please dont read just the subject line and pollute this post with suggestions to use ZXing camera scanning or an SDK based solution for Android only, Xamarin is after all a cross-platform framework.