Quick Setup with SiriKit

In this lesson

To get rolling with SiriKit in iOS 10, there are some up front hurdles to jump. Surprise! This lesson busts through those in record time so we can get on with the business of actually using SiriKit.

4:59 C# 100
David Ortinau
Co-Founder, Developer, Designer


Tap on time to skip ahead



SiriKit is now out for iOS 10, so this allows us to use Siri to interface with our applications. So I want to add that to an application I have right here.


Setup Entitlements & Provisioning

First thing to do is to actually go into the Apple Developer Portal so that we can add that entitlement to our application. So Mindr is the application I’m going to be using, and this is my application ID, and you’ll see down here “SiriKit” is enabled. So you need to enable that and you need to update your provisioning.

So once you’ve done that, now we can go back to our application and we can start setting it up. So I have an iOS application right here and I’m going to add SiriKit to it. So the first thing that I want to do is I want to go into my entitlements.plist and also add that here. You’ll notice that Siri is not actually available in this build of Xamarin Studio and this version of the plist, so what I need to do is I need to go over to my source and I need to add that here.

This is “com.apple.developer.siri” and it’s a boolean, so we’ll go ahead and set that, and “yes”.

Now I want to go into the info.plist, and as I requirement I want to describe how I’m going to be using Siri. I’ll add a new string here. “NSSiriUsageDescription”. And this description will appear when I ask for access to Siri. “Issue commands within Mindr”.

Next I need to actually ask for that permission, so in the AppDelegate.cs the recommended place to put this is in the FinishedLaunching. I’ve got this code snippet here, and this is going to ask for access.


Add and Configure an Intents Extension

Once we have that setup we’re ready to start adding the other projects that we need. The way this works, you add an Intent Extension. If I come over here and I add a new project, within iOS you’re going to see that we have some new options. Under extensions, we Intents Extension. I’m going to go ahead and add this. I’m gonna give it the name “IntentsExtension”. I’ll call it “Mindr.IntentsExtension”. Go ahead and add that. Add that to my project.

What I can do now is I can review what has been configured for us. Now Xamarin has been nice enough to give us with some quick examples here as to how this works. They’ve stubbed out a Send Message Intent, and if we look at our Info.plist, one of the key things that needs to be in here are what the intents are. What are we supporting. What are we doing. If you drill down into the NSExtension, NSExtensionAttributes, and then Intents Supported. You’ll see that this particular extension supports the “send message”, “search for message” and “set message”.

For the time being, all I really want to do is run this and make sure that it works.

When I’m ready to start customizing things, it’s in the IntentHandler that I can do that. And of course I can start organizing my code however I wish. Application specific stuff should be handled in a PCL or Shared Library, and I’ve got some of that already setup over here. When I get to it I can start integrating that.


Hey Siri

But at this point I’m ready to start. On the right hand side of my screen you’ll see that I actually have my device being mirrored here. You can’t test this in the simulator, it has to be tested on device.

Let’s go ahead and hook up to my device, “David’s iPhone”, and let’s run it.

So this is our Mindr application, and of course as we expect the first thing it’s going to do is ask us if we’re going to allow Siri, and you’ll also see my description “Issue commands within Mindr”.

This application is a news feed. We don’t need that open, so we’re going to go ahead and close that. Let’s see what we can do here.

“Hey Siri”

“Send a message with Mindr”

“What do you want to say?”

“Hello from me to you”

“Here’s your Mindr message. It says ‘Hello from me to you.’ Ready to send it?”

She doesn’t know how to say “Mindr”.

“Send it”

“It’s sent”

Now if we try to ask her to do something she doesn’t know about such as:

“Hey Siri, start a reading workout with Mindr”

“I wish I could, but Mindr hasn’t set that up with me yet”

So we get that response. But now we’re all setup and SiriKit is working for us and we can proceed with doing something truly useful.

Additional Info

Register to get access to additional resources and info.