Show virtual Keyboard when bluetooth keyboard connected? - ios

I am building system for my company that use of a bluetooth RFID reader.
The problem is we cannot show the keyboard when the reader is connecting unless we turn it off.
But I saw this video
http://www.youtube.com/watch?v=0uRlIw5H0wE&feature=related
And I know we can modify the reader to temperately show the keyboard.
(Just like the button on Apple iOS keyboard)
We can ask the provider to taylor-made the reader. So we want to add a physical button on it.
Do anyone know the keycode of that button?
Can it be done just to add a button to send a keycode event???

The button that needs to be pressed is the eject button that's on a mac keyboard. I don't know what the key code is or even if you can send it. But I do know it is the eject button.

The iOS keyboard gets hidden when a bluetooth or some other physical keyboard gets connected.
I think that the button is causing the Bluetooth HID-keyboard profile to disconnect at the scanner (which in-turn enables the iOS keyboard)

I have added details on how to show both bluetooth keyboard(using HID profile) and device virtual keyboard here I want to force keyboard on with bluetooth device please check if it helps.

Related

iOS show/hide onscreen keyboard with external keyboard

I have a company app (not on AppStore) that I'm attempting to use with a wired barcode scanner, but also need the onscreen keyboard for manual entry. The scanner itself does not have any "show/hide keyboard" button. I am connecting the scanner with an Apple Lighting to USB3 Adapter, which works great - it connects as an external keyboard.
There are flows in the app that require a user to enter text when a barcode is not available to scan, e.g. login flow. How can I programmatically show the onscreen keyboard for these flows on an iPhone or iPod?
I have used bluetooth scanners that have a button to show/hide the onscreen keyboard. Is it possible to simulate this functionality in code?
The last resort may be to create my own onscreen "keyboard" that I can show and hide at will.

"CBCentralManager(delegate: self, queue: nil)" does not show Bluetooth popup message when Bluetooth is turned off from Control Center

I am trying to navigate the user to Bluetooth settings on a button click. CBCentralManager(delegate: self, queue: nil) works fine when Bluetooth is turned off from Settings App, but it is not working when Bluetooth is turned off from Control center e.g not showing the default Bluetooth popup.
Now I need to know if Bluetooth is turned off from the Control center so that I can show some custom popup message to the user.
Any help will be appreciated.
You are correct that the initialization option CBCentralManagerOptionShowPowerAlertKey, which should display a warning if the framework is initiated when bluetooth is turned off, does in fact not work as expected if bluetooth is toggled off from the Control Center. Since iOS 11 the system will actually not turn off bluetooth if you toggle off the button in Control Center, it only disconnects currently connected devices. The only way to turn off bluetooth then is to do it from System Settings. This is documented by Apple, but to me it is extremely misleading. So I honestly don't know if the API behavior you are experiencing is a bug, or if it is expected behavior.
My suggestion is that you skip this initialization option and instead rely on the value of central.state when you get the "centralManagerDidUpdateState:" callback and then create you own popup if the value is CBManagerStatePoweredOff, which oddly enough will be the case regardless if bluetooth is turned off from System Settings or if it is toggled off from the Control Center.
If your app works in the background you may want to use a local notification instead to get your user's attention.
Not a perfect solution, but it should be more reliable.
I have filed bug report 47516284 with Apple for this problem. Here's the text of the issue I filed.
I have noticed that the system alert notifying a user that an app needs Bluetooth will show when I turn off Bluetooth using the Settings app. I can use this system alert to go directly to bluetooth settings to turn it back on. However, when I turn off Bluetooth using Control center, there is no system alert that displays. This is problematic because although I can display a custom alert to tell the user to turn on Bluetooth, there is no way to code bringing the user directly to Bluetooth settings by tapping a button for instance. I believe the functionality should be consistent no matter how the user turns off Bluetooth.

Default keyboard is not coming when Barcode Scanner Device is Connected by Bluetooth in IOS

I am facing issue with keyboard when barcode scanner device is connected using bluetooth.
Flow:
1) I have turned on Bluetooth, and connected barcode scanner device using bluetooth by entering displayed code in it to connect.
2) I am able to use scanner, but the default keyboard is not displaying even we call becomeFirstResponder.
3) When I disconnect the scanner device or turn off bluetooth connectivity then the keyboard is coming.
Note: Below is the link for the Barcode Scanner device i am using
Barcode Scanner Device Information
Anyone faced this kind of issue?
Please suggest how to fix this issue.
Thanks in Advance..!
This solution only works on Ipad. when the soft keyboard disappears just press and hold the down arrow on the bottom right of the screen and the soft keyboard will be back.
We are clear and there is no question that Bluetooth Scanner is pretending to be a Bluetooth keyboard, so iOS thinks that it does not need to show the on screen one.
For Barcode Scanner type socket mobile are now adding a feature to open the iPad onscreen keyboard. For example, the Socket CHS has a new button press option. You can check if your device have the same functionality*(It is likely to be of some help)*
Bring Up the Virtual Keyboard With a Real Keyboard can be a good idea.
When you have a Bluetooth keyboard connected to your iPad, the virtual keyboard will cease to appear. (This is a good thing.) However, what if, for some random reason, you needed that virtual keyboard? Don't unpair your Bluetooth. Just... Hit the eject key on Apple's physical keyboard. It'll bring up the virtual one.
There is another way to try to solve this, personally I tried it and it was very unstable. Taking into account that it is a kind of hack, expected unstable behavior.
This answer to a related question (https://stackoverflow.com/a/3837131/493988) has what seems like a hack based on a UITextField's inputAccessoryView.
Even the user #Kurt Arnlund in this answer mentions a external app called KeysPlease link here. I really have not tried it, you can try.
In summary, there seems to be a clean way to solve this, I think these may be the best attempts to reach a solution
Sources:
Bluetooth Scanner sets system-wide keyboard, UITextFields wont show soft keyboard on responder
Force on screen keyboard to show when bluetooth keyboard connected
Show iPhone soft keyboard even though a hardware keyboard is connected

How can we know if iPad is using bluetooth keyboard or device virtual keyboard? [duplicate]

This question already has answers here:
How can I detect if an external keyboard is present on an iPad?
(13 answers)
Closed 6 years ago.
I am working on an iPad application which uses Motorola CS3070 bar code scanner. I am connecting the scanner as using HID Profile and it is treated as a bluetooth keyboard by iPad. When scanner is connected to iPad using bluetooth and if we focus on any text field inside application, it won't open device virtual keyboard. This is expected as device treats bar code scanner as bluetooth keyboard.
While doing scanning if the scanner is disconnected, device virtual keyboard will be displayed. What I want is, when scanner is disconnected, I need to get that information from some event and show a popup/alert to user that scanner is disconnected. I think if there is a way to know when device virtual keyboard is displayed or application is using bluetooth keyboard we can use that information to show the popup.
Please let me know if it is possible or any other suggestion which I can try.
Thanks in advance.
An indirect and SDK-safe way is to make a text field a first responder. If the external keyboard is present, the UIKeyboardWillShowNotification local notification shall not be posted.
You can listen to the "GSEventHardwareKeyboardAttached"(kGSEventHardwareKeyboardAvailabilityChangedNotification) Darwin notification, but this is a private API, so it's possible your app will get rejected if you use this. To check if the external hardware is present, use the private GSEventIsHardwareKeyboardAttached() function.
UIKit listens to this and sets the UIKeyboardImpl.isInHardwareKeyboardMode property accordingly, but again this is private API.
I got this answer from here.

Can I create a button that starts Voice Dictation mode in iOS?

I understand this is a bad idea (to show a voice dictation button in the app when it's already on the keyboard when it's available). But I have a client who would really like to have a microphone icon in a text field that would enter voice dictation mode when pressed.
Note, I am talking about the standard OS voice dictation mode (that the keyboard controls).
So the basic question is:
Can I tell the keyboard to enter voice dictation mode?
(my guess is that it's not allowed, but I would love something more "official" than my gut)
This wouldn't be possible unless you were to jailbreak your device. There would be little reason for Apple to offer a public API to do this, because any time you would be able to invoke it is when the keyboard is showing anyway, which would contain the button to activate it.

Resources