Android Question B4A - Force Virtual Keyboard

marvin944

Member
Licensed User
Longtime User
Hi!

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?
 

Sandman

Expert
Licensed User
Longtime User
Sorry, I can't answer your question. But in case you discover you need another option, here's something that might interest:
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Hi!

I am using a snap-on barcode scanner thriugh bluetooth...
Snap-On makes barcode scanners, I missed that one.

What happens when you use the example in the link below?

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.
1671123048739.png


However, none of the text fields now have the virtual keyboard pop-up... Is there a way to use both inputs?
You're clearly doing something strange as the textboxes popup perfect here.


Enjoy...
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
Hi!

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.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
I've always had to have the scanner is SPP mode and monitor it in a service for input.

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.


Cheers ?
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
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.


Cheers ?
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.
 
Upvote 0
Top