Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can my app detect that it was opened by Siri?

Tags:

swift

siri

Can my Swift app detect that it was opened by Siri? I'd like to open to a specific viewController if (and only if) my app was opened by Siri.

like image 591
Jonesie Avatar asked Nov 19 '22 15:11

Jonesie


1 Answers

It became possible in watchOS3.2. in your ExtensionDelegate, implement the function handle(userActivity). If your app is opened from Siri, userActivity.activityType will be the name of the INIntentResponse that was provided by your IntentHandler, so you just have to check if userActivity.activityType equals any of the INIntentResponse names that your Intents Extension can handle.

like image 125
Dávid Pásztor Avatar answered Dec 21 '22 01:12

Dávid Pásztor