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

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 :/

Related

iOS 15 focus mode development

We can set up a focus status with customized turning on time and turning off time. I'd like to be notified when I am in my own app. Unfortunately INShareFocusStatusIntentHandling was not called when a system notification "Focus on" came out. Anybody know some solutions or ideas about it. Thanks ahead!
According to https://developer.apple.com/forums/thread/682143 you need to implement an Intents Extension from your app and have that extension share the results to the main app via UserDefaults or some other method. You cannot observe the focus state changes directly in your app.

UITextField begin dictation

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 an app suppress iOS's multitasking gestures?

Is there a way to suppress gesture recognition? What inspires me to ask this question is watching my grand-daughter, who is a toddler, using an iPad. Quite often, she will accidentally invoke a gesture recognizer that switches apps. An example of this would be the four finger gesture where you can slide an app out of the way.
For a "child proof" app, is it possible to suppress these? Failing that, is it possible to suppress switching to another app? At first thought, that seems out of scope of an app, but maybe there is a way to do it.
You don't need to do it in your app, because it is an accessibility feature of iOS 6. It is called "Guided Access" and you can enable it in Settings -> General -> Accessibility in the Learning section.
I had the same requirement, but you cannot override the gesture recognition. It takes priority over your app.
Actually I wanted to do an app for my baby and had the same requirement!, but you cannot disable the gesture recognition on a non jail broken device ;(
No, but you can turn off it in settings manually. Go to settings> general> Multitasking gestures. I dont think we can control this via coding for normal apps, but you can inform the user to disable it here through an alert before using the app. That is the most appropriate way available now.

UISearchBar and dictation support

I have user interface with UISearchBar and I implement the UISearchBarDelegate's searchBarSearchButtonClicked: to perform the search. I do not have a device with dictation support to test this, so I'm going to speculate here...
On devices with dictation support, I would like to perform the search as soon as the dictation ends, without requiring the user to hit the search button manually.
Does this work out-of-the-box?
Or do I need to handle it programmatically?
Since iOS 5.1, there are new methods in UITextInput protocol and I could theoretically hook onto dictationRecordingDidEnd. Is that the way to go?
Yes, you would want to use the dictationRecordingDidEnd protocol method. Apple's documentation says this about dictationRecordingingDidEnd:
Implement this optional method if you want to respond to the
completion of the recognition of a dictated phrase.
That said, I have yet to find in Apple's human interface guidelines anything that talks about the expected use of this method.
You may also want to look at dictationRecongitionFailed as well as the UIDictationPhrase class.

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