I'm trying to send a text message with a link from my android app to chat applications like Whatsapp or SMS message.
These apps don't accept text/html type as an Intent type and when I'm using text/plain type my message is being sent with the subject only and without the message's body.
I've seen apps that can share links via Whatsapp like Chrome and Dolphin Browser apps.
Here is my code:
@JavascriptInterface
public void sendMessage(String trip) {
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Trip from Voyajo");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml("I've found a trip in Voyajo website that might be interested you, http://www.voyajo.com/viewTrip.aspx?trip=" + trip));
startActivity(Intent.createChooser(emailIntent, "Send to friend"));
}
EXTRA_SUBJECTandEXTRA_TEXTare included in the shared message, in the form "Subject - Extra text". What I did: use onlyEXTRA_TEXT, putting the whole message, including urls, in that. But use plain text, skip all HTML. - Jonik