Download Cordova Plugin


You can contact us on support@tagnpin.com if any assistance is required.
SDK source can be downloaded from here.

Download Cordova Plugin

Follow the steps given below to integrate the InviteReferrals SDK in your android app:-

  1. Go to File click New click Import Module select invitereferrals then finish.

  2. Add the following dependency to your build.gradle file:

    Select All

            dependencies {  compile project(":invitereferrals")  }
         

  3. In the (assets/www/js) folder copy the invitereferrals_plugin.js object.

  4. In the (src/your_package_folder) folder copy the InviteReferralsPlugin.java class.

  5. In the (res/xml/config.xml) file add the below given code:

    Select All

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


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

    Select All

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

  7. 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"/>      <aplication....>
                  <meta-data android:name="invitereferrals_bid" android:value="52X"></meta-data>
                  <meta-data android:name="invitereferrals_bid_e" android:value="6F969A60F73C2218B6913465A5194CFC" ></meta-data>
            </application></manifest>
            


  8. Initializing the sdk
    In the manifest file register our application class like this in application tag:

    Select All

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


  9. Add Referral Button
    To open sharing screen via login page call inline_btn method like this:

    Select All

            invitereferralPlugin.inline_btn(campaignID);
            

    Example:

    Select All

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


  10. 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

            invitereferralPlugin.invite(CUSTOM_RULE);
           
            

    Example:

    Select All

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


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

    Select All

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

    Example:

    Select All

     
            invitereferralPlugin.userDetails("Tom", "tom@gmail.com", "9812546723", 0, null, null);
            


  12. Track Install / Register / Sale Events
    This is how you call tracking() method to track various events:

    Install

    Select All

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

    Register

    Select All

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

    Sale

    Select All

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


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

    Select All

            invitereferralPlugin.showWelcomeMessage();
            


  14. Configure DeepLink
    a) Add intent filter tag of your manifest file activity tag something like this:

    Select All

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


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

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

    Select All

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


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

    Select All

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