Swift 3 - Run an app with specific keyword by using Siri - ios

According to Intents and thanks to this thread, I know that you can open your app via Siri with "Open [APP NAME]",
What I want to know is if it is possible to tell to Siri just only one word like 'Cheese' to open the Camera app or an other specific keyword set beforehand to open your own app using Siri.
Is it possible ? If yes, I have to use Intents to do that or there is another way ?

Siri runs on the OS level, so in order to use any intents you have set within your app, the user must specify your app.
"Get a ride with Lyft" or "Message Mom in Facebook" etc..
More examples in the doc:
https://developer.apple.com/sirikit/

You can use shortcuts app which comes inbuilt in all iOS devices, for knowing more about Siri Shortcuts refer below links.
https://developer.apple.com/documentation/sirikit/adding_user_interactivity_with_siri_shortcuts_and_the_shortcuts_app
https://www.pocket-lint.com/phones/news/apple/144718-what-is-siri-shortcuts-and-how-does-it-work

Related

Basic steps to add Siri functionality to radio app

I would like to be able to tell Siri "Hey Siri, play [app name]" for my radio app, and have it play a default station. What are the basic steps to achieve this? I'm not really looking for a Siri Shortcut per se, but built in "play" functionality. Is this possible?
You can achieve the following with Swift.
However, without any coding, Hey Siri, open [App Name] is possible automatically.
To add custom functionalities such as play a default station, please refer to this link

How to customise SiriKit intent extension for shortcuts app to ask allow access?

We are allowed to build custom intent for Siri, by extending SiriKit.
Moreover, Apples present how to manage basic integrations and customizations to Siri Shortcuts and Shortcuts app
Link for shortcuts app
Nonetheless, some apps have their own shortcuts UI with a little customization; for instance with the button to allow access for API, how can we do that?
In the documentation presented by Apple, there is no such instruction for how is it possible to customize the UI inside the shortcuts app regarding the custom intent created by my app.
I tried to make custom failure for the Intent response but didn't find the option for API access. Like ↴
However nothing quite similar to the UI presented by Shortcuts App, while attempt to first run trello ↴
These actions are provided by the Shortcuts app itself rather than by Siri intents exposed by another app. Indeed, these actions don’t even need the Trello or Wunderlist apps installed.
This means that Shortcuts can present a different UI.
The UI that it will show for your app is defined by the parameters in your intents file.
You can’t create the same experience for your app, however the user can perform any required authorisation in your app itself and it is reasonable to expect that they have run your app before trying to set up shortcuts that use it.

Can I change a value of variable by using Siri Shortcut?

I want to control my BLE Device with the help of Siri. Like "Fan On" or "Fan Off". So, Is that possible with the help of Siri Shortcuts?
Or is there any alternative way to Contorl BLE Device Fan with Siri.
I think if I am able to change a value of variable through Siri Shortcut then I can do this.
I am now able to switch to On or Off my BLE Device Fan with the help of Siri Shortcuts. I just needed to to do one thing that I missed before: to pass the complete class to Siri Shortcuts Intent.
When I invoked Siri and said my own phrase, then Siri will execute the complete class code and off my device fan.
The main thing that I missed is Pass the complete class to Siri Intent rather than passing only specific section of code or function.

How to make Siri launch app on specific keyword?

When I say "Translate English to Spanish" Siri opens the app Google Translate.
How does Siri know to launch this app and is it possible to register your app for certain keywords with Siri?
Usually you can open an app telling Siri something like:
"Open [APP NAME]"
My guess
In your case I guess Siri is not interpreting the sentence. When you say Translate English to Spanish Siri does try to understand what action should take and since no action with an hight Matching Rate is found then Siri tries to open the App having a name equals to the first word of your sentence.
Test 1
In Italian language the app is named Traduttore. When I say Traduci dall'italiano all'inglese (Translate English to Spanish) Siri does NOT open the translator because Traduttore does not match Traduci.
Test 2
If I say: Musica dall'italiano all'inglese (Music italian to english) which is not a real command, Siri does open the Music app.
Siri and third parties apps
Right now the interaction between Siri and third parties apps is pretty limited, however maybe in the future Apple will provide the tools for a deeper interaction.
Maybe something like what is happening with HomeKit where Apple created an interface to make Siri and Home Devices to talk each other.
You should look at Siri's custom vocabulary.
At the moment it is limited to your App's name and Apple specified domains e.g. Workouts or Ride Booking
But if you're lucky enough that your application falls within those categories you can map some more app specific terminology.
For example, if you had a rock climbing application, Ascent, you could start with a voice command similar to "Hey Siri, start climb" rather than "Hey Siri, start workout with Ascent"
All of your localized vocab choices should be placed into their appropriate language-specific project directories (.lproj).

Display all the apps that support sending messages (Chatting)

I want display all the apps in my app that support chatting. Actually I need to send the selected text via message applications (i.e., WhatsApp, WeChat, etc..) those are installed in my iOS device.
I have gone through UIDocumentInteractionController but it allow to share files only. But here in my case I want to share just text.
Is this possible. Please help me out, thanks.
iOS does not have a single option for sharing text, the UIActivityViewController can be used and will show the iOS integrated social networks.
You will be able to add you own service to this dialog, as long a the app has a URL scheme to support its.
A example of a Whatsapp UIActivity: https://github.com/jberlana/JBWhatsAppActivity
If you know the URL schemes (if the chatting app provides one) of the app, you can check if a app exists or not using -canOpenURL: of UIApplication class. If they support url schemes, you can send text in the format that those app supports.

Resources