Download Cordova Plugin


There are different steps to integrate for Cordova as explained below.

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

Download Cordova Plugin

Integration for cordova plugin


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


Follow the steps :File->New->Import Module->notifyvisitors->finish, then:

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

    Select All

        dependencies {
        compile project(":notifyvisitors")
    }
            

  2. In the (assets/www/js) folder copy the notify_plugin.js object.

  3. In the (src/your_package_folder) folder copy the NotifyPlugin.java class.

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

    Select All

    <widget>
    .................
    .................
    <feature name="NotifyPlugin">
    <param name="android-package"
    value="your_package.NotifyPlugin" />
    </feature>
    .................
    .................
    </widget>
            

  5. where your_package is the package name of your app

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

    Select All

          module.exports = [    {  "file": "js/notify_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.GET_ACCOUNTS" />
        <uses-permission android:name="android.permission.WAKE_LOCK" />
        <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    
    <uses-permission android:name="android.permission.GET_TASKS" />
        <permission
            android:name="com.notifyvisitors.nvsdklive.permission.C2D_MESSAGE"
            android:protectionLevel="signature" />
        <uses-permission android:name="com.notifyvisitors.nvsdklive.permission.C2D_MESSAGE" />
        <aplication....>
            <meta-data android:name="notifyvisitors_bid" android:value="52X">      </meta-data>
            <meta-data android:name="notifyvisitors_bid_e" android:value="768B370B0002A3DEE5E8CD991DA80A12" ></meta-data>
            

  8. Initializing the sdk

    In the manifest file register our application class like this in application tag:

    Select All

            <aplication....
            android:name="com.notifyvisitors.notifyvisitors.NotifyVisitorsApplication">
    
            

  9. Showing InApp Notifications

    To show in app popups in your app, you can call the show() method like this:-

    Select All

    
            var newSuccess = function(successMessage) {
               var pageName = successMessage.PageToBeOpened;
                      //alert(JSON.stringify(successMessage));
               var parameters = successMessage.actionParamsArray;
               var params = JSON.stringify(parameters);
               var link = pageName+'?parameters='+params;
                     window.location.href = link;
            };
            notifyPlugin.show((JsonObject)tokens,(JsonObjects)customObjects,(String)fragmentName,newSuccess);
            At the receiving end you can get parameters like:
            var result = app.getUrlParameter('parameters');
            var jsonData =JSON.parse(result);
            var vaaar = jsonData.key2;
    
    
            *newSuccess is required if you want to navigate user within the app, on click of in-app popup, else you can pass null as last parameter in show() method.
    
            

  10. Tracking events

    To track the various app events, call the method event like:-

    Select All

            notifyPlugin.event(String eventName, JSONArray attributes, String ltv, String scope);
            

    where:

    Select All

      
            eventName is the name of the event you want to track for example “sale”,
            attributes is the json array containing different properties of the event in the form of json object 
           
            

    Ltv is the value you want to give to user corresponding to every particular event.
    SCOPE- 1. (called every time the function is called)
    2. (called once for the session)
    3. (called once per lifetime)

  11. User Identifiers

    To identify the different app users, call the method userIdentifier like:-

    Select All

            notifyPlugin.userIdentifier(String userID, JSONArray jsonArray);
            

    where:

    Select All

     
            userID is the unique identifier to identify different users like email, contact number or any other custom user id,
            jsonArray is the json array containing user information in the form of json object.
    
            

  12. Showing Notification Center

    To show notification center in your app, you can call the showNotifications() method like this:-

    Select All

            notifyPlugin.showNotifications((int)dismiss);
            

  13. Showing Instant Push Notification

    To show instant push notification in your app, you can call the scheduleNotification() method like this:-

    Select All

            notifyPlugin.scheduleNotification(String nid, String tag, String time,String title, String message,String url, String icon);
            

    where:

    Select All

     
            nid  is the id of the notification.
            tag is a unique tag(string value)
            time is the time delay after which notification has to be shown
            title is the title of notification.
            message is the message of notification.
            url is the package name of the activity to be open on click of the notification.
            icon is the link of the image to be shown as image on the notification.
    
            ** nid, tag and time are mandatory fields.
    
            

  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>