{"id":28357,"date":"2016-11-02T09:14:03","date_gmt":"2016-11-02T16:14:03","guid":{"rendered":"https:\/\/blog.xamarin.com\/?p=28357"},"modified":"2016-11-02T09:14:03","modified_gmt":"2016-11-02T16:14:03","slug":"say-hello-siri-sirikit","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/say-hello-siri-sirikit\/","title":{"rendered":"Say Hello to Siri with SiriKit"},"content":{"rendered":"<p>\t\t\t\tOne of the most exciting new features of iOS 10 is that it opens Siri to app developers. In this blog post, we&#8217;ll cover the basics of how to add Siri support to your existing apps.<\/p>\n<p><a href=\"https:\/\/s3.amazonaws.com\/blog.xamarin.com\/wp-content\/uploads\/2016\/10\/27101403\/sirikit-96x96_2x.png\"><img decoding=\"async\" class=\"size-full wp-image-28359 alignright\" src=\"https:\/\/s3.amazonaws.com\/blog.xamarin.com\/wp-content\/uploads\/2016\/10\/27101403\/sirikit-96x96_2x.png\" alt=\"sirikit-96x96_2x\" width=\"192\" height=\"192\" \/><\/a><\/p>\n<p>Siri was introduced in 2011 as part of iOS, after Apple acquired Siri&#8217;s developers in 2010 and integrated it into the core of iOS as a digital personal assistant which uses natural language patterns to answer questions, make recommendations, and perform actions.<\/p>\n<p>Prior to iOS 10, Siri was unavailable as a separate app on the App Store. However now, with the release of SiriKit, Apple has made it possible to integrate your app&#8217;s content and service with Siri. SiriKit supports a number of domains, each of which defines tasks that can be performed, including the following:<\/p>\n<ul>\n<li>VoIP calling<\/li>\n<li>Messaging<\/li>\n<li>Payments<\/li>\n<li>Photo<\/li>\n<li>Workouts<\/li>\n<li>Ride booking<\/li>\n<li>CarPlay (automotive vendors only)<\/li>\n<li>Restaurant reservations (requires additional support from Apple)<\/li>\n<\/ul>\n<h3>Domains<\/h3>\n<p>Siri &#8220;thinks&#8221; of things in <em>Domains<\/em>, which are broad categories of concepts, such as messaging, VoIP, payment, workouts, ride booking, and photo search. <em>Domains<\/em> have known actions called <em>Intents<\/em>, and each <em>Intent<\/em> has a series of parameters. Before starting with SiriKit, you&#8217;ll want to ensure that your app fits into a <em>Domain<\/em> that Apple supports.<\/p>\n<h3><em>Intents<\/em> and <em>Intents<\/em> UI Extensions<\/h3>\n<p>If you&#8217;ve ever developed for Apple Maps, you&#8217;ll already be familiar with developing App Extensions using <em>Intents<\/em>. There are two types of <a href=\"https:\/\/developer.xamarin.com\/guides\/ios\/platform_features\/introduction_to_extensions\/\">App Extensions<\/a> used to interact with Siri:<\/p>\n<ul>\n<li><b>Intents Extension<\/b>: Provides Siri and Maps with the app&#8217;s content and performs the tasks required to fulfill any supported intents.<\/li>\n<li><strong>Intents UI Extension<\/strong>: Provides a custom UI that will be displayed for the app&#8217;s content inside of either Siri or Maps.<\/li>\n<\/ul>\n<p>It&#8217;s essential that your app provides an Intents Extension to support SiriKit, but you can opt out of providing a UI Extension since Siri can handle all user interaction using the standard, built-in UI. The Intent Extension can support one or more <em>Intents<\/em>; it&#8217;s up to you to decide how you want to implement Siri in your apps, as there are a number of ways to accomplish it. With that said, Apple has requested that we as developers try to limit the number of Intent Extensions, as this will help keep memory usage down and increase Siri&#8217;s performance.<\/p>\n<h3>Saying Hello<\/h3>\n<p>If we take a simple use case, in this instance adding Siri support to a messaging app, the user might interact with Siri with the follow conversation.<\/p>\n<table border=\"1\" width=\"100%\">\n<tbody>\n<tr>\n<td width=\"50%\"><b>Siri<\/b><\/td>\n<td width=\"50%\"><b>User<\/b><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>&#8220;Hey Siri, send a XamarinChat Message&#8221;<\/td>\n<\/tr>\n<tr>\n<td>&#8220;To whom?&#8221;<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>&#8220;Miguel&#8221;<\/td>\n<\/tr>\n<tr>\n<td>&#8220;What do you want to say to Miguel?&#8221;<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>&#8220;Good job on creating Mono&#8221;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The process of turning this conversation into an actionable item looks like this:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/44\/2019\/03\/siri1.png\"><img decoding=\"async\" class=\"size-full wp-image-28368 alignleft\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/44\/2019\/03\/siri1.png\" alt=\"siri1\" width=\"846\" height=\"132\" \/><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/44\/2019\/03\/siri1.png\">\u00a0<\/a><\/p>\n<ol>\n<li>Siri takes the audio of the user&#8217;s <strong>Speech<\/strong> and converts it into text.<\/li>\n<li>The text is converted into an <strong>Intent<\/strong>, a structured representation of the user&#8217;s request.<\/li>\n<li>Based on the <strong>Intent<\/strong>, Siri will take <strong>Action<\/strong> to perform the user&#8217;s request.<\/li>\n<li>Finally, Siri will present <strong>Responses<\/strong> (both visual and verbal) to the user based on the <strong>Action<\/strong> taken.<\/li>\n<\/ol>\n<div>You&#8217;re not limited to this flow, however, as conversations never follow the same format. Its possible to add vocabulary, app logic, and a custom UI to make the experience even more immersive.<\/div>\n<h3>Privacy and Security Considerations<\/h3>\n<p>Privacy and security was touted as one of the main features of iOS 10 and Apple has taken Siri&#8217;s security very seriously. They have ensured that private information remains secure when working with Siri and have marked particular interactions as requiring the device to be unlocked, for example, requesting a car through Uber or Lyft or making a payment.<\/p>\n<p>You might also want to ensure that the user has unlocked the device before allowing your Siri extension to be used. This is easy to include by adding <strong>Restrict While Locked<\/strong> to your apps Info.plist.<\/p>\n<h3>Learn more<\/h3>\n<p>SiriKit is a huge addition to iOS 10, with lots of options for developers to use to implement it into our apps. If you&#8217;re looking for more information, you&#8217;ll find an in-depth review of the new APIs in our <a href=\"https:\/\/developer.xamarin.com\/guides\/ios\/platform_features\/introduction-to-ios10\/sirikit\/\">documentation <\/a>as\u00a0well as a complete sample project on our <a href=\"https:\/\/github.com\/xamarin\/ios-samples\/tree\/master\/ios10\/ElizaChat\">GitHub<\/a>.\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the most exciting new features of iOS 10 is that it opens Siri to app developers. In this blog post, we&#8217;ll cover the basics of how to add Siri support to your existing apps. Siri was introduced in 2011 as part of iOS, after Apple acquired Siri&#8217;s developers in 2010 and integrated it [&hellip;]<\/p>\n","protected":false},"author":1929,"featured_media":28359,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[6,4,16],"class_list":["post-28357","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developers","tag-ios","tag-xamarin-platform","tag-xamarin-forms"],"acf":[],"blog_post_summary":"<p>One of the most exciting new features of iOS 10 is that it opens Siri to app developers. In this blog post, we&#8217;ll cover the basics of how to add Siri support to your existing apps. Siri was introduced in 2011 as part of iOS, after Apple acquired Siri&#8217;s developers in 2010 and integrated it [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/28357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/users\/1929"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/comments?post=28357"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/28357\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=28357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=28357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=28357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}