All MADP Posts

Intent UI - Sirikit

Praneet Pyati - Aug 31, 2017 - Engineering

The blog has been submitted by Saurabh Mendhe

SiriKit

Kony has introduced Intent extension as one of the app extension which internally uses SiriKit. Using this extension we can achieve the following things listed below –

-  VoIP calling

-  Messaging

-  Payments

-  Photo

-  Workouts

- Ride booking

Each domain defines one or more tasks that an app can perform.These tasks are known as intents because they represent the intentions of the user, and each intent is represented by a custom class whose properties contain information related to the task.

In a nutshell what SiriKit offers is the chance to teach Siri how to do a few things related to an existing app. For example, given a messaging app, you can make Siri capable of sending messages the same way the app does, so the user can use that app by just talking to Siri. This allows developers to take advantage of Siri's advanced voice recognition and conversational skills.

The entry point of your Intents extension is the INExtension object, whose sole job is to direct Siri to the objects capable of handling incoming intents. In your extension, there are three types of objects that you use regularly to handle intents:

  • An intent object contains the data that Siri gathered from the user.
  • A handler object is a custom object that you use to resolve, confirm, and handle the intent.
  • A response object contains your response to the intent.

When the user makes a request involving your app, SiriKit creates a corresponding intent object. If the intent has parameters that need to be resolved, SiriKit asks your handler to resolve those parameters individually. When all parameters have been resolved, SiriKit asks you to confirm your readiness to handle the intent. If you indicate that you are ready, SiriKit tells you to handle the intent.

In Kony, the Kony developer writes the Intent extinction app in Kony IDE using Kony’s Intent extension apis and native bindings.

There are 2 types of Intent extension which we can develop using Kony Viz.

  • Intent Extension (WithoutUI) : When you create a target for Intent Extension it won’t come with the any UI.
  • IntentUI Extension (IntentUI Extension) : Kony creates an empty view and expose it to the js space. Kony developer can make use of native bindings FW generated for UIKit, Foundation, etc to build there UI and business logic.

 

Requesting Siri Authorisation in your Kony app for Intent Extension.

Users must grant permission for your app to use SiriKit. To request permission for your app, you must do the following:

  • Include the NSSiriUsageDescription key in your iOS app’s Info.plist file. The value for this key is a string that describes what information your app shares with SiriKit. For example, a workout app might set the value to the string “Workout information will be sent to Siri.” Inclusion of this key in your Info.plist is required. (in VMAppWithKonyLib.xcodeproj)
  • Enable the Siri under capabilities for the Main app.

How IntentUI Extension works - Details

When you handle an intent, Siri and Maps often display the details from the response object your Intents extension provided in a standard interface. If you want to add your own custom content to the standard interface, you must provide an Intents UI extension.

An Intents UI extension does not replace the Intents extension that you use to handle intents. It is a separate app extension that lets you customize how your response to an intent is presented to the user. You can use a custom interface to show additional details or to incorporate your app’s branding, which can provide a more familiar experience for the user.

You can provide an Intents UI extension if you are supporting intents in the following domains:

Messaging

Payments

Ride booking

Workouts

Important Notes

  • If you want to customize the interface displayed by Siri or Maps, you can also add an Intents UI extension to your app. The Intents UI extension is not a replacement for your Intents extension; if you provide an Intents UI extension, you must also provide an Intents extension. 
  • You may add more than one Intents extension to your app, but each extension must support different intents. Create multiple extensions only if doing so provides a performance advantage or reduces the memory footprint of each extension.
  • Siri treats custom vocabulary as hints, incorporating as much of your custom terminology as it can. Focus on terms whose usage might be confusing otherwise and always prioritize terms so that the most important ones are first in your list.
  • It is recommended that you always provide a global vocabulary file with your app and use it to specify one or more example phrases for each of your app’s supported intents. Although the global vocabulary file is not required, the App Store issues a warning for apps that declare Siri support but do not include sample phrases for its intents.

 

References –

https://developer.apple.com/sirikit/

https://developer.apple.com/library/content/documentation/Intents/Conceptual/SiriIntegrationGuide/SiriDomains.html

https://developer.apple.com/library/content/documentation/Intents/Conceptual/SiriIntegrationGuide/