For some time, as a user, I've noticed that on some apps I can perform common operations on partial texts, as such:

This is called "smart text selection" (video here), and it has being around from Android O, as shown here.
Recently Google has shown how to make your app show the actions within itself (meaning inside its TextView). This is called "Smart-Linkify" and the video about it can be found here. It shows there how to show the actions:

What I can't find is how to do the opposite. Meaning how to offer my own actions to other apps.
For example, I could make a dialer app that can handle phone numbers by either dialing them or search the phone number.
In the past, I've asked about a very similar thing, of Android M, here. There is also a nice tutorial about it, here. However, this is about a general text, without a type of when to trigger, meaning it will always be shown.
I've found very few mentions about this feature. The only sample I've found is here, but I can't build it for some reason, and it's not even about providing the actions. It's about how to show the actions.
I've found a Github repository of the Android dialer, here. It also offers an action of "call" for phone numbers. After playing around with the manifest, I've found that this part is responsible for offering this action:
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tel" />
</intent-filter>
If I remove this part, I don't see the action of "call" for this app anymore (till I re-add it).
Sadly, if I change the "DIAL" action to "SEARCH", it doesn't show up.
The good news are that I can see the action if I add this part to a new project.
OK, seeing that I fail to do it, over and over, no matter what I try, I think the answer is that it's just not supported.
The reason is that Google probably collects various actions that developers request around the world, and use the list for the device. More information here. To quote from there:
Get your app discovered in more places across multiple Google and Android surfaces. Your Actions can appear in the Android launcher, Smart Text Selection, the Google Search app, the Google Assistant, and the Play Store.
Here's a list of existing special Intents actions that developers can use.
It doesn't have a special one for phone number searching, but it has some other special actions instead.
In order to request more actions to be available, developers can request it here.
I hope this will be available forever, because I don't think a lot of developers even know about this.
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