0

Couldn't find the answer to my problem, so here is my question: I have an app storing debts and where i can send the debt info to anyone using ShareActionProvider in the actionbar. It all works fine, i can send a string via, let's say, whatsapp. So far, so good. I wanted to include a link to the app in the play store at the end of the message but couldn't find out how to do it.

Here the intent I'm sending via the ShareActionProvider

Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_TEXT, share_message);
i.setType("text/plain");

How can i achieve to add something like this: Don't forget to check out this

NicolaF
  • 127
  • 1
  • 11

2 Answers2

1

just append the link to the end.

Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_TEXT, share_message + " https://play.google.com/store/apps/details?id=" + getPackageName());
i.setType("text/plain");
r2DoesInc
  • 3,759
  • 3
  • 29
  • 60
  • My answer differs from the other as it is not necessary to hardcode your package name into the string. you should be able to call `getPackageName` and get the package name for the url. – r2DoesInc Aug 13 '14 at 19:03
  • Thanks! I think this is better than nothing, but what i wanted to achieve was actually to use a String holding the link. As to say the words 'click here' with the link to the play store, instead of having the written link. – NicolaF Aug 13 '14 at 19:33
  • ya no. you cannot send a hyperlink. – r2DoesInc Aug 13 '14 at 19:35
  • Ahaaa! So that's why I couldn't find the answer, i just can't :D too bad. Thanks a lot! – NicolaF Aug 13 '14 at 19:37
0
Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_TEXT, share_message + " https://play.google.com/store/apps/details?id=com.google.android.apps.maps");
i.setType("text/plain");
sddamico
  • 2,130
  • 16
  • 13
  • As i commented above, this is still something, but what i wanted to do was to add a String holding the link after the share_message. Something like the words 'click here' with the link inside. – NicolaF Aug 13 '14 at 19:35
  • Ahh, unfortunately that will depend on the individual receiving app's ability to process some form of markup – sddamico Aug 13 '14 at 19:59