Copied To Clipboard



Import the NotifyVisitors SDK in your project

Demo APK

  1. Add the following dependency to your app's build.gradle file:
  • Dependencies

        repositories {
            maven {
                url ""
        dependencies {
            implementation 'com.notifyvisitors.notifyvisitors:notifyvisitors:4.1.4'
            //Add the following required libraries if not using currently (skip those which are already added)
            implementation ''
            implementation ''
            implementation ''
            implementation ''
            implementation ''
            implementation ''
            implementation ''

Configure AndroidManifest.xml

  1. Insert the below XML snippet inside application <application> tag of your AndroidManifest.xml file

Note :

In below example Dummy Brand ID and Secret keys shown. Kindly login to your account to see your credentials.
  • XML Snippet
        <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 <manifest> tag of your AndroidManifest.xml file
  • XML Snippet

            <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="android.permission.ACCESS_NETWORK_STATE"/>
            <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
            <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
            <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>


Initialize the SDK

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



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

  • Initialize SDK

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

  • Dynamic Tokens

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

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

  • Custom Rules

        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

Configure FCM Credentials

  1. Go to FCM ( ) and register your app (Skip if already done).

  2. Copy Sender Id and Legacy server key from Fcm.

  3. Download the latest config.json file (google-service.json file) (Skip if already done).

  4. In NotifyVisitors panel, Configure Sender Id and Legacy server key in Android Configuration section.

Configure Push in your App

  1. If you don’t have your own firebase integration, then add the below permissions in your app's manifest file.

  • Configure Push Permission


                <action android:name="" /> 


If you have your own firebase integration, then call below given function where you receive remote message from firebase.

  • Configure Push Permission

            if (intent.hasExtra("nv_source")) {
                String value = intent.getExtras().getString("nv_source");
                if (value.equals("1")) {
                    if(NotifyVisitorsApi.getInstance(this).isPayloadFromNvPlatform(remoteMessage.toIntent())) {
        } catch (Exception e) {
  1. Add the below permission in your app's build.gradle

  • Configure Push Permission
        apply plugin: ''
  1. Paste the downloaded google-service.json file in your app folder in IDE (Skip if already done).

Configure Notification’s Icon

For below Lollipop (version 5.0) devices:- Devices below Lollipop (version 5.0) 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 (version 5.0) & above devices:- Devices supporting Lollipop (version 5.0) & 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.

To get small push icon effect in your status-bar,

  1. Go to Android Asset Studio.

  2. Select Notification Icon Generator.

  3. Select Image under Source menu.

  4. Copy and paste your small push icon their.

  5. Enter its name in Name menu.

  6. Download the images from the top-right-corner icon . It will be downloaded as zip.

  7. Unzip it and paste all folders in your app.

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.

  • Show Notifications


Track Users

User API enables you to track a user's 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).

  • Track Users

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

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

  • Track User Sample Code

        JSONObject userObject=new JSONObject();
            try {
            } catch (JSONException e) {
            NotifyVisitorsApi.getInstance(getActivity()).userIdentifier("yourUserID", userObject);

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.

  • Track Events

        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

  • Track Events

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