Background
Android M presents a new way to handle selected text (link here), even from outside of your app . Text selection can be handled as such:
I know it's possible to handle the selected text from outside the app, because if I go to the web browser (or any other place that allows text selection), I can see that I can use the "API demos" app to handle the selected text.
The problem
I can't see a lot of information about how to do it.
The question
- What should be added in code (and manifest) to be able to handle the selected text from outside the app ?
- Is it possible to limit the selection to certain types of texts ? For example, offer to show the app only if the text type is a valid phone number ?