Search code examples
androidandroid-intentgmailcustom-url

Send link with custom scheme through Gmail


I'm trying to send a deep link that opens my Android app:

String body = "<a href=\'myscheme://myurl?Id=37\'>Link to simulation</a>";
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/html");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "share");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body));
startActivity(Intent.createChooser(emailIntent, "Email:"));

But when I got the email with the code above and with my Gmail through desktop chrome brower I got only plain text.
When I send http://myurl I do get the link.

Is it possible to send link with custom scheme?


Solution

  • Use tinyurl api to generate short link http://tinyurl.com/api-create.php?url=myscheme://myurl?Id=37 you get http://tinyurl.com/ofmudsw