I'm trying to use the intent anchor to launch my app as described here. I'm able to get it to launch my app using this syntax,
<a href="intent://#Intent;scheme=http;package=com.example.myapp;end">Launch my app</a>
but I have no idea what many of the various elements mean.
The basic syntax for an intent-based URI is as follows:
intent:
HOST/URI-path // Optional host #Intent; package=[string]; action=[string]; category=[string]; component=[string]; scheme=[string]; end;
- what do each of the segments mean (so I know how I may best use take advantage of them)
- how/where can I include any extra data (ie, my own parameters)
As at android 28, the API has changed. Here is what the
toUri
code has been changed to:This shows that the chosen answer will no longer work.
Check this answer by David Wasser for a working solution.
Here is the method
toUri()
from theIntent
class:If you can read Java code then it should be pretty clear what is going on here. In any case, extras can be put in the URL and they look something like this:
where
<type>
is one of the following:Here are a few examples:
Launch app:
Launch app with one String extra called "foo" containing the value "bar123":
Launch app with a String extra called "foo" containing the value "bar123" and an Integer extra called "number" containing the value "-567":