I've been looking forever, but haven't found… Do you know if there's a way to determine whether my iOS app was launched by Siri or by the user tapping the app icon?
I need to know because I want to automate a startup action only when my app is launched from Siri.
I was thinking that maybe application:didFinishLaunchingWithOptions or some other API would allow my app to know how it was launched, but that doesn't seem to be the case (or I just missed it).
Any idea if there's some trick available that I could use until Apple publishes some official/public Siri API ?
The only thing I can suggest is to check the launchOption dictionary passed in as part of application:willFinishLaunchingWithOptions:
and application:didFinishLaunchingWithOptions:
.
There is one key that claims to list the name of the application that requested your apps launch and maybe Siri would be listed:
From the apple doc located here:
UIApplicationLaunchOptionsSourceApplicationKey
The presence of this key identifies the app that requested the launch of your app. The value of this key is an NSString object that represents the bundle ID of the app that made the request. This key is also used to access the same value in the userInfo dictionary of the notification named UIApplicationDidFinishLaunchingNotification. Available in iOS 3.0 and later. Declared in UIApplication.h.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With