Download Android SDK


Using Gradle
Using Eclipse

Click here to download
Sample App
Demo APK

Steps common for both Android Studio and Eclipse



1. Configure your AndroidManifest.xml

Select All


<manifest....>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.GET_TASKS" />
    <aplication....>
        <meta-data android:name="invitereferrals_bid" android:value="52X" >
</meta-data>
        <meta-data android:name="invitereferrals_bid_e" android:value="6F969A60F73C2218B6913465A5194CFC">
</meta-data>
    

If your app already has install referrer in AndroidManifest.xml file,
then you need to call InviteReferrerBroadcastReceiver.onReceive() from your app install receiver
like this -

Select All

   public void onReceive(Context context, Intent intent) {
        new com.invitereferrals.invitereferrals.
                InviteReferrerBroadcastReceiver().
                onReceive(context, intent);}
        
     


2. Initializing the sdk

a) If you don’t have your own application class, then in the manifest file register our application class like this in application tag:

Select All

    <aplication android:name="com.invitereferrals.invitereferrals.InviteReferralsApplication"></application>

b) If you have your own application class then inside your application class onCreate method, call our register method like this:

Select All

   InviteReferralsApplication.register(this);


3. Add Referral Button

Add the following line in your custom button click. Replace CampaignID with the id of the referral campaign. Default campaignID will be applied if no campaignID specified

Select All

   InviteReferralsApi.getInstance(this).inline_btn((int)CampaignID);

where:

Select All

  
    InviteReferralsApi.getInstance(this).inline_btn(1765);

    For Default Campaign you can pass 0 as CampaignID: 
 
    InviteReferralsApi.getInstance(this).inline_btn(0);


4. Show Refer a friend Popup

Just add the following line in the activity in which you want to show the referral program popup.

Select All

    InviteReferralsApi.getInstance(this).invite((String)CUSTOM_RULE);

where:

Select All

 
    InviteReferralsApi.getInstance(this).invite("home");

You may then set rules in the inviteReferrals campaign settings to show campaign popup after specific time delay or after specific number of App launches on this view.



5. Pass User Details for Auto-Login (Single Sign In)

Select All

    InviteReferralsApi.getInstance(this).userDetails((String)name, (String)email, (String)mobile, 0, (String)subscriptionID, (String)customValues);

where:

Select All

    InviteReferralsApi.getInstance(this).userDetails('Tom', 'tom@gmail.com', '9812546723', 0, null, null);


6. Track Install / Register / Sale Events

This is how you call tracking() method to track:

Install

Select All

    InviteReferralsApi.getInstance(this).tracking("install", null, 0, null, null);

Register

Select All

   InviteReferralsApi.getInstance(this).tracking("register", (String)EMAIL_ID, 0, (String)referCode, (String)unique_code);

Sale

Select All

    InviteReferralsApi.getInstance(this).tracking("sale", (String)ORDER_ID, (int)PURCHASE_VALUE, (String)referCode, (String)unique_code);


7. Show Welcome Message

Show welcome message to the customer if he comes through the referral of his friend.

Select All

    InviteReferralsApi.getInstance(this).showWelcomeMessage();