Copied To Clipboard



Import the NotifyVisitors SDK in your project

Default Attribute Names -

  1. Download the SDK from the link given below.
  2. Download SDK Sample App Demo APK

    Extract the file. Now in Android Studio open your app project goto File -> New -> Import Module and browse the extracted folder (i.e. notifyvisitors) and click on finish

  3. Add the following dependency to your build.gradle file:
  • Android

        dependencies {
            compile project(":notifyvisitors")

Configure AndroidManifest.xml

  1. Insert the below XML snippet inside application tag of your AndroidManifest.xml file
  • Android

            <meta-data android:name="notifyvisitors_bid" android:value="52X"</meta-data>
            <meta-data android:name="notifyvisitors_bid_e" android:value="768B370B0002A3DEE5E8CD991DA80A12"</meta-data>
  1. Insert the below XML snippet inside manifest tag of your AndroidManifest.xml file
  • Android

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

Initialise the SDK

  1. Initialise the SDK from the onCreate method of your Application class.
  • Android



If you don’t have your own application class, then you can register our application class in the manifest file.

  • Android

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

InApp Notifications

InApp Notifications include both Banners and Surveys. These are displayed based on Android Activity.

Every event occurs in the context of an Activity. Every activity can be associated with some contextual data, which can be used as targeting rules for In-App Notifications.

Call the below show() Method in onCreate method of every activity. show() Method should be called only once per activity.

  • Android


Dynamic Tokens() -Dynamic tokens are used to show personalised content in Notification messages real time.

  • Android

        JSONObject category = new JSONObject();
        try {
        } catch (JSONException e) {

Custom Rules() - This data can be used in configuring targeting rules for the Notifications.

  • Android

        JSONObject category = new JSONObject();
        try {
        } catch (JSONException e) {

Fragment Name (string) - If you have multiple fragment tabs in your activity, you can call the show method for each fragment and pass the fragment name as third argument.

Push Notifications

Add permissions in AndroidManifest.xml file

  • Android

            <uses-permission android:name=""/>
            <permission android:name="your_app_package_name.permission.C2D_MESSAGE"
            android:protectionLevel="signature" />
            <uses-permission android:name="your_app_package_name.permission.C2D_MESSAGE" />

Configure Notification’s Icon

For below Lollipop devices:- Devices below lollipop shows only one icon in the push notifications, that you can configure from notifyvisitors panel.To change default notification icon, you can replace icon sm_push.png in notifyvisitors/src/main/res/drawable folder.

For Lollipop & above devices:- Devices supporting Lollipop & above shows two notifications icon i.e., small push icon & large push icon.

Large push icon is configured from panel & is shown as main push icon. However if large push icon is not configured from panel then small push icon is shown as main push icon.Small push icon

Small push icon according to android documentation( should be transparent, otherwise it will be shown as square white spot. To change default notification icon, you can replace icon sm_push_logo.png in notifyvisitors/src/main/res/drawable folder.

Show Notification Center

You can show a list of push notifications received in an In-app Notification Center. Expiry of the notifications can be set from the panel.

You can call the showNotifications() method to show Notification Center on any click action.

  • Android


Track Users

User API enables you to track a users' activity as they move from device to device and attach attributes to their profiles. Attributes enrich user profiles, like email, username, mobile, gender etc. This method should be called when the user is identified (mostly on login).

  • Android

        NotifyVisitorsApi.getInstance(getActivity()).userIdentifier(String userID,JSONArray jsonArray);   

USER_ID - Setting the Unique ID is a critical piece to tie a user across devices and installs/uninstalls as well across all platforms (i.e. iOS, Android, Windows, The Web). Unique ID can be something like an email ID, a username (unique), or any Backend generated ID.

USER_ATTRIBUTES (JSON object) - You can set the user attributes like name, email, mobile number. These can then be used to send personalised content in notifications. But these attributes can not be used in segmenting the users.

Default Attribute Names -

  • name
  • email
  • mobile

You can also pass your custom attributes like username, birthday, first name, last name.


Attribute Names should contain only alpha-numerics, white spaces or ‘_’ ; No other special characters are allowed.
Recommended names - ‘first_name’, ‘last_name’

Sample Code

  • Android

        JSONArray userArray=newJSONArray();
            JSONObject name = new JSONObject();
            JSONObject number = new JSONObject();
            try {
            } catch (JSONException e) {

Track Events

Event API enables you to record any actions your users perform, along with any properties that describe the action. These are then used for analytics, user segmentation or to trigger engagements or other actions.

  • Android

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

EVENT_NAME (string) Name of the event like sale, register.
Event names should contain only alpha-numerics, white spaces or ‘_’ ; No other special characters are allowed.

EVENT_ATTRIBUTES (JSON object) Attributes associated with the event.
Attribute values should be passed in the form of Javascript strings, booleans and numbers respectively. Similarly date attribute values are expected in the form of Javascript date objects.


Attribute Names should contain only alpha-numerics, white spaces or ‘_’ ;
No other special characters are allowed.
Recommended names - ‘category’, ‘price_usd’

LIFETIME_VALUE (integer) The score you would like to reward the user on performing this event like 10, 100.

SCOPE (integer)The scope of the event, whether it should be tracked every time it is called, or per session, or once in a lifetime. This parameter is used to minimise the duplication of data in analytics.
It is an integer whose values are :

  1. Track every time the api is called
  2. Track once per session
  3. Track once in a lifetime

  • Android

        JSONObject eventAttributes = new JSONObject();
        try {
        } catch (JSONException e) {
        NotifyVisitorsApi.getInstance(getActivity()).event("eventName", eventAttributes, "7","2");