Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ACTION_SEND Hyperlink not working in GMail

This is my code for sending an HTML email in Android, with a clickable link.

private void sendEmail()
{

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
String subject = "Prueba";
String emailtext = "<a href=http://www.google.es>PruebaEmail</a>";
emailIntent.setType("message/rfc822");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(emailtext.toString()));

startActivity(Intent.createChooser(emailIntent, "Send mail"));
}

Months ago, it was working and sends a clickable hyperlink, but for now, when I receive the mail in my GMail account, there is no hyperlink, just plain text.

I have tried all of this in the type:

emailIntent.setType("message/rfc822");

and

emailIntent.setType("plain/text");

and

emailIntent.setType("text/html");

and this for the text:

String emailtext = "<a href=http://www.google.es>PruebaEmail</a>";

and

String emailtext = "<a href='http://www.google.es'>PruebaEmail</a>";

and

String emailtext = "<a href="http://www.google.es">PruebaEmail</a>";

but none of that are working.

This issue is just for GMail, because if I send the mail to Evernote or another app, I got a clickable link.

This is my API configuration:

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="8"/>

and compiling with Android 3.2

Any ideas?

like image 518
sarian85 Avatar asked Jan 28 '13 11:01

sarian85


1 Answers

OK finally found the solution for the things to work. The link in the href and outside has to be exactly same. Deleted my comments they are now irrelevant.

The problem is with gmail client 4.2.2 i have the latest one it seems :) The gmail client 4.1.2 worked just fine for the href tag what you had written.

And its really stupid of the gmail client to work like this.

like image 116
Jayshil Dave Avatar answered Nov 01 '22 18:11

Jayshil Dave