Download Android SDK


Using Gradle
Using Eclipse

Click here to download


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.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.GET_TASKS" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <permission android:name="your_app_package_name.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <uses-permission android:name="your_app_package_name.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>


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


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


b) If you have your own application class and you are unable to register our application class in manifest.
Then inside your application class onCreate method, call our register method like this:


Select All

 NotifyVisitorsApplication.register(this);

3. Showing InApp Notifications

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

Select All

  
NotifyVisitorsApi.getInstance(this).show(null,null,null);


4. Showing Notification Center

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

Select All


NotifyVisitorsApi.getInstance(this).showNotifications(0);
   


5. Tracking events

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

Select All

    
        NotifyVisitorsApi.getInstance(getActivity()).event(String eventName,
        JSONArray attributes, String ltv, String scope);

where:

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

Select All

        
        JSONArray eventArray = new JSONArray();

        JSONObject price = new JSONObject();

        JSONObject category = new JSONObject();

        try {

        price.put("price","20000");

        category.put("firstCategory","standard");

        category.put("secondCategory","fancy");

        } catch (JSONException e) {

        e.printStackTrace();

        }

        eventArray.put(price);

        eventArray.put(category);

     

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)

6. User Identifiers

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

Select All

   
NotifyVisitorsApi.getInstance(getActivity()).userIdentifier(String userID,

        JSONArray jsonArray);

where:

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

Select All

    
       
        JSONArray jsonArray = new JSONArray();

        JSONObject name = new JSONObject();

        JSONObject number = new JSONObject();

        try {

        name.put("name","Basant");

        number.put("number","9898765489");

        } catch (JSONException e) {

        e.printStackTrace();

        }

        jsonArray.put(name);

        jsonArray.put(number);