I am using a snap-on barcode scanner thriugh bluetooth and this is recognized by the phone as a HID Keyboard. However, none of the text fields now have the virtual keyboard pop-up... Is there a way to use both inputs?
THIS version is no longer updated and supported. You can continue to use it if you want. Or try the new version with rewritten methods and new features IMPORTANT depends on SD CreativeBackGround (0.06+) library which must be downloaded MaterialIcon font for special characters must be loaded...
Updated implementation, based on B4XPages of https://www.b4x.com/android/forum/threads/android-bluetooth-bluetoothadmin-tutorial.14768/#content. The code is much simpler compared to the previous example. Note that you can call Serial.Listen without making the device discoverable. This is useful...
www.b4x.com
PLEASE NOTE:
USE AStream.Initialize and NOT AStream.InitializePrefix (don't use InitializePrefix), check the code below. Within 5 minutes of downloading the Bluetooth example, I had tested it with multiple Bluetooth scanners, it works perfect every time.
B4X:
Sub AfterSuccessfulConnection
If AStream.IsInitialized Then AStream.Close
'prefix mode! Change to non-prefix mode if communicating with non-B4X device.
'AStream.InitializePrefix(serial.InputStream, False, serial.OutputStream, "astream")
AStream.Initialize(serial.InputStream, serial.OutputStream, "astream")
ConnectionState = True
B4XPages.ShowPage("Chat Page")
End Sub
I scanned a pack of Duracell batteries, tested with 5 different brands of barcode scanners and Bluetooth example works perfect every dingle time.
I am using a snap-on barcode scanner thriugh bluetooth and this is recognized by the phone as a HID Keyboard. However, none of the text fields now have the virtual keyboard pop-up... Is there a way to use both inputs?
To the best of my knowledge there is no way to have an HID scanner and virtual keyboard act in concert. I've always had to have the scanner is SPP mode and monitor it in a service for input. Service raises an event (e.g. "Barcode_Scanned") which the running activity can monitor.
Arn't most scanners set by default to SPP and not HID, SSP mode didn't even cross my mind. I just opened up a new scanner, connected via Bluetooth and scanned using Erels chat example.
Anyway, if it's a standard scanner it comes with a booklet/sheet with barcodes inside. Marvin can use the barcodes in the booklet/sheet to change from HID mode to SPP mode.
Arn't most scanners set by default to SPP and not HID, SSP mode didn't even cross my mind. I just opened up a new scanner, connected via Bluetooth and scanned using Erels chat example.
Anyway, if it's a standard scanner it comes with a booklet/sheet with barcodes inside. Marvin can use the barcodes in the booklet/sheet to change from HID mode to SPP mode.
In my experience it varies widely by brand. Most of the ones we buy currently are HID BT/2.4gHz-USB dongle and they default to USB mode, we have to set them
specifically for SPP for our app.