1

I'd like to share different information depending on the application selected by the user. For example, I'd like to send shorter text to Twitter than I do Gmail (otherwise, I go over in characters). Is there anyway to achieve this? Bonus question, is it possible to make hyperlinks via sharing via Gmail or SMS. For example, "Download here" where 'here' is a link instead of "Download by clicking the link below: http://..."

Current code:

Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, getTextToShare(data));
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, data.getTitle());
startActivity(Intent.createChooser(shareIntent, "Share this story"));
Sean Thomas
  • 129
  • 12

2 Answers2

0

To find the selected share target this could be interesting for you: Branching the Android Share Intent extras depending on which method they choose to share

Community
  • 1
  • 1
Andre Classen
  • 3,868
  • 3
  • 26
  • 36
0

By using below code may helps you:

String shareText="Download <a href='[download link]'>here</a>";
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, Html.toHtml(shareText));
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, data.getTitle());
startActivity(Intent.createChooser(shareIntent, "Share this story"));

Share Url Links and Texts into Social Networks (Facebook,Twitter and linkedin)

pRaNaY
  • 24,642
  • 24
  • 96
  • 146