Booking Rides using SiriKit

24 / Feb / 2017 by Eliza Dhamija 0 comments

In iOS 10, SiriKit can be used to add app’s services with a system. SiriKit provides services for the below-mentioned domains. To avail it, you need to create an app extension using 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 a CarPlay-enabled vehicle

Intents: 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 app. Each intent is represented by custom class where you can modify information for a specified task.

Intents UI: It is an optional extension to customize Siri or map after intent has been handled.

Steps to create Intent extension:

  1. Create a new iOS Project
  2. Switch on Siri capability from capabilities tab in iOS app target1
  3. Select File->New->Target, from here add “Intent Extension” from application extensions, you can add one or more extensions.2
  4. 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.3
  5. In info.plist of Intent Extension, select NSExtension->NSExtensionAttributes->IntentsSupported
  6. Add items in IntentsSupported, default you will get INSendMessageIntent, INSearchForMessagesIntent, INSetMessageAttributeIntent. But for booking a ride you need to change it to INRequestRideIntent, INGetRideStatusIntent, INListRideOptionsIntent. You can add multiple intent and the sequence of intent will decide priority for same.4
  7. In info.plist of app add key NSSiriUsageDescription/Privacy – Siri Usage Description, here you have to add product description.5
  8. in didFinishLaunching of app delegate, make request for Siri: INPreferences.requestSiriAuthorization{status in print(status)}
  9. In IntentHandler.swift class, add appropriate intents and make sure to declare same in info.plist
  10. Customize INListRideOptionsIntentHandling delegate in IntentHandler.swift class as per your requirement to show Ride price, time left and any other message.
  11. Build App with selection of extension scheme, option will open to select Siri6
  12. Run App on device
  13. Now you can test example by saying things to Siri
  14. Make sure to upload GeoJSON file as your app’s Routing App Coverage File in iTunes Connect with the regions specified for which you are going to provide ride service.7

Tag -


Leave a Reply

Your email address will not be published. Required fields are marked *