How to check whether Dictation is enabled in iOS Keyboard.? - ios

I have to show an Image highlighting the Mic icon in iOS keyboard saying "Tap here to speak". But the Mic icon won't be displayed if dictation is disabled in Keyboard settings.
My aim is to check whether dictation is enabled at the time of launching the app. If not, I want to show a prompt to Enable Dictation from "Settings>KeyBoard>Enable Dictation"
Is there any way to check whether dictation is enabled when the app is launched.?

Short answer is that checking whether the dictation is enabled is not possible.
Currently there are only few things that developers can play with in terms of dictation. They are defined in UITextInput Protocol. Sadly, what you're looking is not there.

Related

"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

Programmatically "tap" the Microphone key on the iOS keyboard [duplicate]

I'd like to programmatically put my UITextField input into dictation mode, without requiring the user to bring up and select dictation from the keyboard. Searched the API documentation but can find no solution. Any ideas?
This is currently not possible on iOS.
The only place where it is kind of possible is in an app using WatchKit. In WKInterfaceController you can actually use presentTextInputControllerWithSuggestions with nil as parameter which starts dictation input immediately.
Yes
With iOS 10 Apple added SFSpeechRecognizer which allows for starting speech recognition without user interaction.
You have to implement SFSpeechRecognizer, use Accelerate framework to get mic sound level floats and make an animated view yourself. It will look cooler!
Sorry for not providing the code, I think i lost it. Can’t find it on my multiple hard drives :/

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.

Show virtual Keyboard when bluetooth keyboard connected?

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.

Resources