[TIMOB-23511] iOS10: Support SiriKit
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-12-01T07:44:08.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 6.0.1 |
Components | iOS |
Labels | ios10, qe-6.0.1 |
Reporter | Hans Knöchel |
Assignee | Chee Kiat Ng |
Created | 2016-06-13T23:01:55.000+0000 |
Updated | 2016-12-21T19:59:12.000+0000 |
Description
iOS 10 finally exposed SiriKit, the public framework to interact with Siri. It allows the developer to send requests to Siri in order to fetch information from the following services:
- Audio or video calling
- Messaging
- Payments
- Searching photos
- Workouts
- Ride booking
Docs: https://developer.apple.com/library/prerelease/content/documentation/Intents/Conceptual/SiriIntegrationGuide/index.html
We should expose it as
ti.siri
with Hyperloop to access the Intents
and IntentsUI
framework. The big problem to solve here is, that Siri needs to be implemented inside a new target, which currently is only supported by creating a native target manually.
Attachments
File | Date | Size |
---|---|---|
IMG_0177.PNG | 2016-11-30T17:56:36.000+0000 | 1719310 |
IMG_0178.PNG | 2016-11-30T17:56:42.000+0000 | 355690 |
IMG_0179.png | 2016-11-30T17:56:41.000+0000 | 642785 |
IMG_0180.png | 2016-11-30T17:56:40.000+0000 | 704298 |
sirikit-sample-app.zip | 2016-11-30T17:59:53.000+0000 | 2580207 |
That would be awesome! What is a target @hans? Thanks
[~chmiiller] A target is configured as part of an Xcode project. Currently, we have one target that represents the (universal) iOS application. Having support for watchOS apps, we can link native targets (aka extensions) to the Titanium application. So in order to support this, we need both some CLI adjustments as well as the receiver in the Titanium application. That's why I did not set a "Release Version" yet.
Hey guys, I was able to create a (basic) proof of concept to use Siri to send Messages via the
INSendMessageIntent
(it's one of the above intents). Following the steps in TIMOB-17335, I did the following: 1. Create a native Titanium App withappc new
2. The name of the example isTestApp
, thecom.appc.testapp
3. Open Xcode and create new project File->New Project->Other->Empty 4. Name itTestApp
4. UseFile->New->Target->Application Extension->Intents Extension
to create the target. By default, Xcode will add some demo code to handle Message Intents, but you can use whatever you want there. 5. Name itTestApp
and change Organization Identifier tocom.appc.testapp
so that theBundle Identifier
iscom.appc.testapp.testapp
- You can also suffix it to something likesiriextension
, but this is more simple for now 6. If you wish, you can activate scheme when prompted, it doesn't matter. 7. Create folderextensions
in Titanium Project (root) folder and copy the Xcode extension project into it. 8. In tiapp.xml, include these properties in10. Create or edit your App-ID to include the "Siri" capabilities, just like you would do with "Access Groups" or "Push Notifications" in the iOS dev-center 11. Create one app without a wildcard and one with a wildcard (e.g.
com.appc.testapp.*
andcom.appc.testapp
). The first one is linked in the provisioning profiles section of the target (<provisioning-profiles>
), the latter one is used to build the main target / your app. 12. Add the following to the ios-plist-section of your tiapp.xml (<tiapp>
-><ios>
-><plist>
):13. Create a file called
TestApp.entitlements
in your Titanium project root (Note: if you also use push-entitlements, copy those keys over there as well, since it will override the CLI-generated one) and paste the following into it:14. You made it!! Use
appc run -p ios -T device
or Appcelerator Studio to run your app on the device - SiriKit does not work on the Simulator You can test the changes by talking to Siri: {quote}Send a Message with TestApp{quote} It will know that your app uses theIntent Extension
for handling messages and will ask you for Siri permissions by displaying the message you specified in your plist. You can also specify multiple intents of course, just create another target and link it the same way as above. And finally, use Hyperloop or a native module to handle the Intent's responses. Since there dozens of classes and delegates to implement here, you should look for the ones your Intent uses and it will be notified by your extension. We may also release a Hyperloop sample app for this, covering a specific Intent use-case, but that's how you can already start using SiriKit today! I also attached some images from my test-app will the app itself as well. Code strong! *EDIT*: Also made a new guide "[Creating iOS Extensions: Siri Intents](https://wiki.appcelerator.org/display/guides2/Creating+iOS+Extensions%3A+Siri+Intents)" with screenshots and more details. Thanks guys!Awesome [~hansknoechel]!!!
Validated, successfully created a titanium app with support for SiriKit, following the guide provided above. Tested On: iPhone 6 Plus 10.1.2 Device Mac OS Sierra (10.12.2) Ti SDK: 6.0.1.v20161219165108 Appc Studio: 4.8.0.201611121409 Appc NPM: 4.2.8 App CLI: 6.0.0 Xcode 8.2.1 Node v4.4.7 *Closing ticket.*