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 class.
1.5 In the (res/xml/config.xml) file add the below given code:

  <feature name="InviteReferralsPlugin">
  <param name="android-package"
  value="your_package.InviteReferralsPlugin" />
  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

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

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:



For Default Campaign you can pass 0 as CampaignID: 

5. Show Refer a friend Popup

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



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);


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:


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


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


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.


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" />
           <action android:name="android.intent.action.VIEW" />
           <category android:name="android.intent.category.DEFAULT" />
           <category android:name="android.intent.category.BROWSABLE" />
           android:scheme="example" />

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>