InviteReferrals

Cordova SDK

Integration for Cordova SDK

Download Cordova SDK

📘

You can contact us on [email protected] if any assistance is required.

  • SDK source can be downloaded from here.

1. Integrate the SDK

1.1 Go to File click New click Import Module select invitereferrals then finish.
1.2 Add the following dependency to your build.gradle file:

dependencies {  compile project(":invitereferrals")  }

1.3 In the (assets/www/js) folder copy the invitereferrals_plugin.js object.
1.4 In the (src/your_package_folder) folder copy the InviteReferralsPlugin.java class.
1.5 In the (res/xml/config.xml) file add the below given code:

<widget
  <feature name="InviteReferralsPlugin">
  <param name="android-package"
  value="your_package.InviteReferralsPlugin" />
  </feature>
  </widget>
  where  your_package is the package name of your app.

1.6 In the (assets/www/cordova_plugin.js) edit the module.exports to register invitereferrals_plugin.js & deep_link.js like this:

module.exports = [    { "file": "js/invitereferrals_plugin.js" }, {"file": "js/deep_link.js"}    ];

2. Configure your AndroidManifest.xml

<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"/>      
            <aplication....>
            <meta-data android:name="invitereferrals_bid" android:value="29XX8"></meta-data>
            <meta-data android:name="invitereferrals_bid_e" 
            android:value="DD85448BF2XXXX482D5F8C28425AAC6F" ></meta-data>
            </application></manifest>

3. Initializing the sdk

  • In the manifest file register our application class like this in application tag:
<aplication android:name="com.invitereferrals.invitereferrals.InviteReferralsApplication"></application>

4. Add Referral Button

To open sharing screen via login page call inline_btn method like this:

invitereferralPlugin.inline_btn(campaignID);

Example:

invitereferralPlugin.inline_btn(1765);
For Default Campaign you can pass 0 as CampaignID: 
invitereferralPlugin.inline_btn(0);

5. Show Refer a friend Popup

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

invitereferralPlugin.invite(CUSTOM_RULE);

Example:

invitereferralPlugin.invite("home");
CUSTOM_RULE will get set from web panel

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

invitereferralPlugin.userDetails(name, email, mobile, campaignID, subscriptionID, customValues);

Example:

invitereferralPlugin.userDetails("Tom", "[email protected]", "9812546723", 0, null, null);

7. Track Install / Register / Sale Events

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

Install

invitereferralPlugin.tracking("install", null, 0);

Register

invitereferralPlugin.tracking("register",EMAIL_ID, 0);

Sale

invitereferralPlugin.tracking("sale", ORDER_ID, PURCHASE_VALUE);

8. Show Welcome Message

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

invitereferralPlugin.showWelcomeMessage();

9. Configure DeepLink

9.1 Add intent filter tag of your manifest file activity tag something like this:

<activity android:name=”MainActivity”
           <intent-filter android:label="@string/launcher_name">
           <action android:name="android.intent.action.MAIN" />
           <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
           <intent-filter>
           <action android:name="android.intent.action.VIEW" />
           <category android:name="android.intent.category.DEFAULT" />
           <category android:name="android.intent.category.BROWSABLE" />
           <data
           android:host="nextpage.html"
           android:scheme="example" />
           </intent-filter></activity>

9.2 In the (assets/www/js) folder copy the deep_link.js object.

9.3 Create a DeepLink.js file & copy the following code into that file:

function handleOpenURL(schemeData) {
   var link = schemeData.split('://');
   var url = link[1];
   window.location = url;
   }

9.4 Register DeepLink.js file in your index.html file like this:

<script type="text/javascript" src="js/DeepLink.js"></script>

Updated 28 days ago

Cordova SDK


Integration for Cordova SDK

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.