Push Notifications

Configure features of push in NV.

1) Configure in NotifyVisitors Panel

a) Go to FCM and register your app.

b) Copy Sender Id and Server key from FCM.

c) Go to NotifyVisitors panel and from mobile push menu go to Android section inside configuration section from left side menu panel and Paste Sender Id and Server key there.

2) Configure in App

Follow the below steps, if you don't have your own Firebase Integration :

a) Download the latest config json file (google-service.json file) and paste it in your app folder in IDE.

b) Add the below permissions in App’s manifest file.

<service
   android:name="com.notifyvisitors.notifyvisitors.NVFirebaseMessagingService"
   android:permission="${applicationId}.notifyvisitors.custom.PERMISSION">
   <intent-filter>
       <action android:name="com.google.firebase.MESSAGING_EVENT" />
   </intent-filter>
</service>

c) Add the below permission in your app’s build.gradle.

apply plugin: 'com.google.gms.google-services'

OR

Perform the below function in case you have your own firebase integration:

try {
   if (intent.hasExtra("nv_source")) {
       String value = intent.getExtras().getString("nv_source");
       if (value.equals("1")) {
           if(NotifyVisitorsApi.getInstance(this).isPayloadFromNvPlatform(remoteMessage.toIntent())) {
                  NotifyVisitorsApi.getInstance(this).getNV_FCMPayload(remoteMessage.toIntent());
           }
       }
   }
} catch (Exception e) {
   e.printStackTrace();
}
try {
    if (intent.hasExtra("nv_source")) {
       val value = intent.extras!!.getString("nv_source")
       if (value == "1") {
             if (NotifyVisitorsApi.getInstance(this).isPayloadFromNvPlatform(remoteMessage.toIntent())) {
                   NotifyVisitorsApi.getInstance(this).getNV_FCMPayload(remoteMessage.toIntent())
             }
       }
    }
} catch (e: Exception) {
    e.printStackTrace()
}

3) Configure Icons --> IMPORTANT

For below Lollipop devicesFor Lollipop & above devices
Devices below lollipop shows only one icon in the push notifications, that you can configure from notifyvisitors panel.

To change the default notification icon, you can replace icon sm_push.png in your app’s module app/src/main/res/drawable folder.
Devices supporting Lollipop & above shows two notifications icons i.e., small push icon & large push icon.

Large push icon: It 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: It will be set according to android documentation (https://developer.android.com/about/versions/android-5.0-changes.html). It should be transparent, otherwise it will be shown as square white spot.

📘

Info

To change default small push icon, you have to add icon smpush_logo.png in your app’s module app/src/main/res/drawable_ folder.

The size of monochrome icon(i.e., small push icon) will be 200x200 in PNG format. And also follow below given steps, it is mandatory.

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 ( Note: Select here your Monochrome icon).

  4. Copy and paste your small push icon there on.

  5. Enter its name in the “Name Menu” on the left side ( Note: Name here will be as "sm_push_logo") .

  6. Download the images from the top-right-corner icon. Download it as a zip file.

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