I am trying to send a text message with a link from my Android application to chat applications such as Whatsapp or SMS.
These applications do not accept the text / html type as the Intent type, and when I use the text / plain type, my message is sent only with the subject and without the body of the message.
I have seen apps that can share links through Whatsapp, such as Chrome browser apps and Dolphin.
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")); }
source share