Reach out to your local office below or click contact us.
Learn more about working at Mobiquity.
Apple introduced a new powerful voice functionality with iOS 12 and upcoming iOS 13: Siri Shortcuts. This new Siri function gives developers the opportunity to create connections inside your applications that Siri uses to improve the end user’s experience by being able to use application functionalities without needing to open the app.
For more background info, check my previous article about how Siri Shortcuts reduce the friction between users and applications.
A nice example can be found here: https://developer.apple.com/documentation/sirikit/soup_chef_accelerating_app_interactions_with_shortcuts
I used these to develop my health application TakeURPill.
Siri Shortcuts have two flavours and each one has a specific use:
Activities are used to communicate to Siri when a user visualises a specific section of the application, so Siri can suggest this section in the future based on user behaviour. Through this suggestion the user can open a specific section of the application directly. The user can also create a custom voice command to open the section.
Intents are used to communicate to Siri when a user uses a specific function of the application. Like the Activity, Siri can suggest the intent and the user can handle the action without opening the application, also with a custom voice command.
In this article, I focus on Activities.
Before going in-depth, two important remarks:
TakeUrPill is a simple iOS application that helps you to keep track of the pills you took. It’s an open-source project which you can clone/fork from here.
It has only 3 functions:
Function #2 takes place within the homepage of the application, the other two happen in two different sections in the app.
A good use case for Activity in the TakeUrPill application is the History section. The user action related to this function is only to open and view a specific part of the application. So it would be great if the user can open the History right away by just asking Siri “Show my pills”.
The first step is to define an identity for the activity “the user opens the history view controller”. In the info.plist of your application, target add NSUserActivityTypes and add it to it a unique string to identify the activity, for example, com.mobiquityinc.demo.TakeUrPill.history:
(TakeURPill application info.plist)
Then you can create a specific service that handles the interaction between your presenter/view model and Siri.
At this point, we need to focus only on ActivityInformationstruct and activitySetupfunction.
The struct is an easy way to pass, the details from the Presenter to SiriService about any Activities we wants to share with Siri, like this:
let information =
activityTitle: NSLocalizedString("activity.history", comment: ""),
activitySuggestedInvocation: NSLocalizedString("activity.history.suggestion", comment: ""))
activityType is the string we defined in the info.plist, activityTitle is the title that will be displayed to users. The last one is a suggestion we give to the user about the voice command the user can associate to the activity.
The activitySetup function returns a NSUserActivity with all the information present into the ActivityInformation, information that Siri needs to present and to handle this activity. It’s important to set the new NSUserActivity property isEligibleForPrediction as true, otherwise, your activity will be not passed (“donate” is the official Apple term) to Siri!
activity.isEligibleForPrediction = true
Apple suggests setting the userActivity property of your UIViewController in the viewDidAppear function.
Now, every time the user opens the History UIViewController, the application donates the com.mobiquityinc.demo.TakeUrPill.history activity to Siri. The last thing to create is the logic to show the History UIViewController to the user.
This implementation can change based on the architecture of your application. In this case, TakeURPill adopts MVP with a FlowController and these are the steps:
(How the user can access directly the History of TakeUrPill from the Spotlight section)
Follow Mobiquity on Medium to receive a notification on the follow up article we will publish soon. This will focus on Siri Custom Intents, introduced with iOS 12, and Siri Conversational Shortcuts introduced with iOS 13.
We believe that addressing customer challenges gives you opportunities to delight. Using our proprietary Friction Reports and strong industry expertise, we dig deep into customer sentiment and create action plans that remove engagement roadblocks. The end result is seamless, relevant experiences that your customers will love.