Vishal Mokal Vishal Mokal - 4 months ago 9
Android Question

Not able to share link in text message android 6.0

I am sharing a link from my application via text message to other applications like Whatsapp in following way.

Intent sendIntent = new Intent();
sendIntent.putExtra(Intent.EXTRA_TEXT, message);

context.startActivity(Intent.createChooser(sendIntent, "Share"));

The message is:

"I think you'll like this " + assetsList.getAssetTitle() + ". " + "" + assetsList.getAssetId()

This link get shared properly in Lollipop and pre-Lollipop devices but not in Marshmallow (Only text get shared not link).

Do I need to put some extra permission.


It would seem that link parsing method for whichever app you're choosing to handle the message has changed in the newer version. I'm not certain that this is directly related to the Android version, as the link parsing is pretty much up to the app handling the containing text. However, if the app is using Android's built-in linkifying methods, then it very well could be that those have indeed changed in Marshmallow.

An any case, prepending http:// to the URL shouldn't break anything in older versions, and apparently is the solution in this particular situation.