{"id":46343,"date":"2017-02-24T15:09:33","date_gmt":"2017-02-24T09:39:33","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=46343"},"modified":"2017-02-24T15:09:33","modified_gmt":"2017-02-24T09:39:33","slug":"booking-rides-using-sirikit","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/booking-rides-using-sirikit\/","title":{"rendered":"Booking Rides using SiriKit"},"content":{"rendered":"<p><span style=\"font-size: small\">In <a title=\"iOS application development\" href=\"http:\/\/www.tothenew.com\/mobile-ios-application-development-services\">iOS <\/a>10, SiriKit can be used to add app&#8217;s services with a\u00a0system. SiriKit provides services for the\u00a0below-mentioned domains. To avail it, you need to create an app extension\u00a0<\/span><span style=\"color: #000000\"><span style=\"font-size: small\">using the <\/span><\/span><strong><span style=\"color: #000000\"><span style=\"font-size: small\">Intents and Intents UI framework:<\/span><\/span><\/strong><\/p>\n<ul>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Audio or video calling<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Messaging<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Sending or receiving payments<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Searching photos<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Making restaurant reservations<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Ride Booking<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Workouts<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Adjusting settings in a CarPlay-enabled vehicle<\/span><\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000\"><span style=\"font-size: small\"><b>Intents: <\/b><\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">You need to perform associated tasks respective to Intents and this extension is required for this. Basically, intents are tasks related to a domain, which is performed by an\u00a0app. Each intent is represented by custom class where you can modify information\u00a0for a specified task.<\/span><\/span><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-size: small\"><b>Intents UI: <\/b><\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">It is an optional extension to customize Siri or map after intent has been handled.<\/span><\/span><\/p>\n<p><span style=\"color: #000000\"><span style=\"font-size: small\"><b>Steps to create Intent extension:<\/b><\/span><\/span><\/p>\n<ol>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Create a new iOS Project<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Switch on Siri capability from c<\/span><\/span><span style=\"color: #000000\"><span style=\"color: #000000\"><span style=\"font-size: small\">apabilities tab in iOS app target<\/span><\/span><\/span><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-46637\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/114.png\" alt=\"1\" width=\"1153\" height=\"721\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/114.png 1153w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/114-300x187.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/114-1024x640.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/114-624x390.png 624w\" sizes=\"(max-width: 1153px) 100vw, 1153px\" \/><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Select File-&gt;New-&gt;Target, from here add \u201cIntent Extension\u201d from application extensions,\u00a0you\u00a0can add one or more extensions.<\/span><\/span><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-46638\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/24.png\" alt=\"2\" width=\"1157\" height=\"699\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/24.png 1157w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/24-300x181.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/24-1024x618.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/24-624x376.png 624w\" sizes=\"(max-width: 1157px) 100vw, 1157px\" \/><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">New folder of extension and extensionUI will be created in your project. Here extensionUI is optional to choose, use it only if you want to customise map after intent has been handled.<\/span><\/span><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-46640\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/34.png\" alt=\"3\" width=\"1175\" height=\"751\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/34.png 1175w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/34-300x191.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/34-1024x654.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/34-624x398.png 624w\" sizes=\"(max-width: 1175px) 100vw, 1175px\" \/><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">In info.plist of Intent Extension, select <\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">NSExtension<\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">-&gt;<\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">NSExtensionAttributes<\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">-&gt;<\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">IntentsSupported<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Add items in <\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">IntentsSupported, default you will get <\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\"> INSendMessageIntent, INSearchForMessagesIntent, INSetMessageAttributeIntent<\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">. But for booking a ride you need to change it to <\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">INRequestRideIntent, INGetRideStatusIntent, INListRideOptionsIntent. You can add multiple intent and the sequence of intent will decide priority for same.<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-46641\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/43.png\" alt=\"4\" width=\"1171\" height=\"749\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/43.png 1171w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/43-300x191.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/43-1024x654.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/43-624x399.png 624w\" sizes=\"(max-width: 1171px) 100vw, 1171px\" \/><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">In info.plist of app add key <\/span><\/span><span style=\"color: #000000\"><span style=\"font-size: small\">NSSiriUsageDescription\/Privacy &#8211; Siri Usage Description, here you have to add\u00a0product description.<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-46642\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/54.png\" alt=\"5\" width=\"1176\" height=\"626\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/54.png 1176w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/54-300x159.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/54-1024x545.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/54-624x332.png 624w\" sizes=\"(max-width: 1176px) 100vw, 1176px\" \/><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\"><span style=\"color: #000000\"><span style=\"font-size: small\">in didFinishLaunching of app delegate, make request for Siri: <\/span><\/span><strong><span style=\"color: #000000\"><span style=\"font-family: 'Times New Roman', serif\"><span style=\"font-size: small\">INPreferences.requestSiriAuthorization{status in\u00a0print(status)}<\/span><\/span><\/span><\/strong><\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">In IntentHandler.swift class, add appropriate intents and make sure to declare same in info.plist<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Customize INListRideOptionsIntentHandling delegate in IntentHandler.swift class\u00a0as per your requirement to show Ride price, time left and any other message<\/span><\/span>.<\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Build App with selection of extension scheme, option will open to select Siri<\/span><\/span><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-46643\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/64.png\" alt=\"6\" width=\"1186\" height=\"738\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/64.png 1186w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/64-300x186.png 300w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/64-1024x637.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/64-624x388.png 624w\" sizes=\"(max-width: 1186px) 100vw, 1186px\" \/><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Run App on device<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Now you can test example by saying things to Siri<\/span><\/span><\/li>\n<li><span style=\"color: #000000\"><span style=\"font-size: small\">Make sure to upload GeoJSON file as your app&#8217;s Routing App Coverage File in iTunes Connect with the regions specified for which you are going to provide ride service.<\/span><\/span><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-46644\" src=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/74.png\" alt=\"7\" width=\"213\" height=\"335\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2017\/02\/74.png 477w, \/blog\/wp-ttn-blog\/uploads\/2017\/02\/74-190x300.png 190w\" sizes=\"(max-width: 213px) 100vw, 213px\" \/><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In iOS 10, SiriKit can be used to add app&#8217;s services with a\u00a0system. SiriKit provides services for the\u00a0below-mentioned domains. To avail it, you need to create an app extension\u00a0using the Intents and Intents UI framework: Audio or video calling Messaging Sending or receiving payments Searching photos Making restaurant reservations Ride Booking Workouts Adjusting settings in [&hellip;]<\/p>\n","protected":false},"author":1070,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":8},"categories":[1400,1],"tags":[4462],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/46343"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1070"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=46343"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/46343\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=46343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=46343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=46343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}