I am having a screen through which user can share referral code on Facebook, WhatsApp, Twitter and Instagram. (I already have an API to generate referral codes). Now I was going through branch.io documentation. But all I could find was deep linking. I am not able to understand how to use branch.io to share the referral codes across all these platforms or should I use something else to program this functionality.
4 Answers
Alex from Branch.io here.
We actually used to offer a referral code feature exactly as you've described, but deprecated it a while back in favor of a referral link system. The reason why is actually quite interesting: our partner apps found codes unnecessary and a lot of extra work. The way Branch handles referrals is fundamentally different and far more user-friendly, so you actually don't need to make the user enter a code at all.
Traditional app referral process
Inviting User
gets a codeInviting User
gives a code to a friend (Invited User
) and says 'go download this app and enter my code!'Invited User
hopefully downloads the app, hopefully finds out how to enter a code, hopefully enters the code correctlyInviting User
gets a reward
As you can see, plenty of places where that process can go wrong.
Branch referral process
Inviting User
gets a linkInviting User
sends the link to a friend (Invited User
)Invited User
clicks the link, is sent directly to the Play Store, downloads the app, and automatically triggers the referral redemption logic without any manual workInviting User
gets a reward
This works because Branch tracks the user who originally created the link, and can report back on that when the new user successfully downloads/purchases/whatever else the first time after opening the link. It is a much simpler and more seamless process, and the Branch referral infrastructure is so reliable that it 'just works'.
Here is the documentation page for setting this up: https://dev.branch.io/features/referral-programs/
Using the Share Sheet
Branch offers a pre-built share sheet on Android that you can use to post these links via any installed app. It may not be especially useful to you because you've already built your own custom icons, but it would avoid an error if one of those apps is not available.

- 13,147
- 1
- 27
- 44
This will allow you to share on every application possible
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "share content");
startActivity(Intent.createChooser(sharingIntent, "share using"));

- 573
- 1
- 7
- 17
-
how can this be used to share referral code on facebook,instagram,whatsapp and twitter? – Mar 14 '17 at 12:04
-
implement this code on the onclickListener of your share option and this will give you a dynamic share option from apps like facebook, gmail, skype , whatsapp etc which are installed on your mobile – Dhiraj Devkar Mar 14 '17 at 12:12
Why not send referal code / link using sharing intent
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(sendIntent);
see the Documentation for more info
and you can filter the app using the answer over Here
Best way to share such information is via http url's as most of the sharing platforms don't allow to post pre-filled text.
Most of the sharing platforms read the meta content inside the html page of the url and make a post accordingly.
Go through this link for meta tags to be used for Facebook
:-
https://developers.facebook.com/docs/sharing/webmasters
And, for sharing links use this:-
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain");
share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
share.putExtra(Intent.EXTRA_SUBJECT, "Title Of The Post");
share.putExtra(Intent.EXTRA_TEXT, "<source url>");
startActivity(Intent.createChooser(share, "Share text to..."));

- 789
- 3
- 21
-
how can this be used to share referral code on facebook,instagram,whatsapp and twitter? – Mar 14 '17 at 12:04
-
Create a html and put it on your server and share it's link via android or iphone devices. For more details checkout:-https://developers.facebook.com/docs/sharing/webmasters – Karan Kalsi Mar 14 '17 at 12:08
-
This code is common for all platforms no need to change if you are sharing url of the page. – Karan Kalsi Mar 14 '17 at 12:09
-
-