In which, I use Siri to create in-app third party commands while taking a break from cooking for Thanksgiving
Earlier today, I had a brainstorm. Maybe I was just overthinking the whole custom Siri thing for third party apps. I didn't want to install a proxy server or jailbreak my iPhone. I just wanted to use Siri dictation to issue commands to my apps, and I wanted to do that without having to display a keyboard that took up 50% of my iPhone screen.
So I chatted with Steven Troughton-Smith about overriding the keyboard by setting its inputView to a custom toolbar, and then using a button to start and stop Siri dictation. This last bit, the custom UI (sorry, but I wanted pretty) is the only "hacking" per se involved here. Instead of overwhelming the screen, he suggested I link directly to UIDictationController and tell it to start and stop dictation.
Originally, I was really aiming for doing a custom view without text at all and implementing UITextInput but apparently there's some other protocol I'm missing, so I ended up reverting to the standard text field with the blinking cursor you see at the top of the video. I'll figure that bit out later.
So what I do is this: I start dictation on the button press, stop it on the button release, and then catch the interpreted text and compare it against four words: up, down, left, and right. If these are found, the app runs the matching animation.
The big idea is this: instead of having Siri interpret commands and return ACE objects that match tasks I want to accomplish (my original approach), I do the text matching and interpretation myself.
In the end, the solution is both low rent and really easy to apply. You could even get this in App Store if you were willing to show the entire keyboard, and not just the start/stop button.
Check it out in action here:
Subscribe to Newsletter
Software Updatesmore updates
- Spotify update adds equalizer, refreshed Artist page and more
- Fantastical 2.1 for iOS adds new snooze, search and notification features
- ExpanDrive 4, more services and faster sync
- Apple adds iTunes Extras to Apple TV
- Spotify updates with new iPhone controls in time for summer BBQs
- iTunes U update will bring course creation and student discussion to iPad app