Advanced Notifications Settings

Notification options affection behaviour & Payload Information

When sending push notifications from iZooto, we collect these requests and send them to Google and Apple who then distribute them to your subscribers. These notifications are "held" by their servers until the device becomes online.

Show Latest

If sending frequent notifications, especially on something that is changing like "election updates" or "cricket scores", you may want to consider Show Latest. This allows replacing older or irrelevant notifications with newer ones; solving the problem of notifications piling up and overwhelming users whenever they are not actively checking their notifications.

Show Latest works by only showing the latest notification of a given type, replacing all the other unread notifications of the same type that have been sent before the current one. For instance, if you are sending notifications related to a cricket match and want to update users on the latest scores, you would want to replace those notifications with whatever is the latest one.

The way this works is by adding a Campaign Tag (API parameter: override_tag) to particular types of notifications you are sending wherein you would like the latest notification to replace the earlier ones. Then, every time you wish to have a future notification override previous ones, you add the same Campaign Tag (override_tag) to it.

If your app sends three notifications with the same Campaign Tag like:

  1. Sent at 10:31 AM: "India off to a solid start. 25 for 0 after 3 overs."
  2. Sent at 11:18 AM: "India continue their onslaught. 84 for 0 after 9 overs."
  3. Sent at 11:47 AM: "India lose their first wicket. 95 for 1 after 10 overs."

If a user does not open their device until 12 PM, they would only see the third notification. If the user opened the device at 11 AM and then at 12 PM, they would see the first notification, and then at 12 PM, they would see the third notification.

👍

This is available for Web, Android and iOS push.

Removing Notifications without Replacing Them

In certain cases, you may want notifications to "self-destruct" or be removed from the device without replacing them with others. There are a couple of options available for this:

Android: Within the Notification Service Extension, use the native Android API setTimeoutAfter method to remove the notification after a certain amount of time.

iOS: Apple provides the native removeDeliveredNotifications(withIdentifiers:) method and getDeliveredNotifications(completionHandler:) method to target the expired notifications and remove them.


Notification Grouping

Android Notification Grouping

🚧

Behaviour Changes

  • Manually setting the group only works on Android 6 and lower.
  • Android 7.0+ will automatically group your notifications after the device has 4 or more visible notifications for your app.
  • Android 7.0+ automatically generates the text for the summary notification for the grouped notifications.

For Android 7+, you can setup your Android NotificationExtensionService to group messages and add another NotificationExtenderService to update the summary. Please refer to Android's Group Notify Guide for more details.

Note that there are some limitations that Android 7+ has for these summary notifications. You can only modify the text, accent color and small icon. However, you can still modify the children.

iOS Notification Grouping

With iOS 12+, Apple introduced the concept of grouping notifications with specific "thread ids" along with adding a summary and how many notifications within that summary. Please refer to this documentation from Medium for more details.


Time to Live

This is the number of seconds a notification will be held by the FCM/APNS/VAPID servers before being delivered to your users if their device is not online by the time of sending.

From the panel, this can be set in Days, Hours, or Minutes.

425

If you are using the Rest API, this needs to be defined in seconds using the ttl parameter.

If no value is specified, this defaults to 24 hours for all the channels. This means if the device does not come online within 24 hours, the message will not be sent to that device.

For example, if you set TTL to 3 hours (10800 seconds) and my device does not have an internet connection for 3 hours and 1 second or longer, I will not get the notification.

TTL does not remove the notification from the device once it has been received. You can use our Show Latest feature to achieve this.

For more details on setting the TTL parameter, please see our Campaign Creation guide.

iOS Limitation - Apple will only store the most recent notification sent to a device on the APNS servers. If you send multiple notifications to an iOS device while it is offline, only the most recent notification will show when the device comes back online. Please see Apple's APNS Overview for more details on this.


Deep Links and URLs

Using Additional Data or the API additional_params parameter, you can pass data into the notification and handle it programmatically within the SDK using our onNotificationOpened method.

381

For example, if you set customkey : profile as the data, you can detect this key : value pair in your app and send the user to the "Profile" page or any other page you decide to use for the value.

// INITIALIZATION
iZooto.initialize(this)
  .setNotificationReceiveListener(new ExampleNotificationHandler())
  .build();

// METHOD CALL
class ExampleNotificationHandler implements NotificationHelperListener {
 
  @Override
  // FIRES WHEN A NOTIFICATION IS RECEIVED
  public void onNotificationReceived (Payload payload) {
    Log.i("iZootoExample", "payload = " + payload.getTitle());
  }
  
  /*
  1. If we clicked notification, then it will show actionType 0.
  2. If we clicked button 1, then it will show actionType 1.
  3. If we clicked button 2, then it will show actionType 2. */
  
  // FIRES WHEN A NOTIFICATION IS CLICKED
  public void onNotificationOpened (String data) {
    String actionType;
    try {
      JSONObject jsonObj = new JSONObject(data);
      actionType = jsonObj.String("actionType");
      
      if (actionType.equalsIgnoreCase("0")) {
        Intent intent =new Intent(getApplicationContext(), YOURACTIVITY.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
      } else if (actionType.equalsIgnoreCase("1")) {
        Intent intent =new Intent(getApplicationContext(), YOURACTIVITY.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
      } else if (actionType.equalsIgnoreCase("2")) {
        Intent intent =new Intent(getApplicationContext(), YOURACTIVITY.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
      }
    } catch (JSONException e) {
        e.printStackTrace();
    }
  }
}
// INITIALIZATION
iZooto.initialize(this)
  .setNotificationReceiveListener(ExampleNotificationHandler())
  .build()

companion object {
  lateinit var instance: MyApplication
    private set
  }

// METHOD CALL
internal class ExampleNotificationHandler : NotificationHelperListener {
  
  // FIRES WHEN A NOTIFICATION IS RECEIVED
  override fun onNotificationReceived(payload: Payload) {
    Log.i("iZootoExample", "payload = " + payload.title)
  }
  
  /*
  1. If we clicked on notification then, it will show actionType 0.
  2. If we clicked on button 1 then, it will show action type 1.
  3. If we clicked on button 2 then, it will show action type 2.*/
  
  // FIRES WHEN NOTIFICATION IS CLICKED
  override fun onNotificationOpened(data: String) {
    var actionType: String? = null
    try {
      val jsonObj = JSONObject(data)
      actionType = jsonObj.getString("actionType")

      if (actionType.equals("0")) {
        val intent = Intent(instance, YOURACTIVITY::class.java)
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        instance.startActivity(intent)
      } else if (actionType.equals("1")) {
        val intent = Intent(instance, YOURACTIVITY::class.java)
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        instance.startActivity(intent)
      } else if (actionType.equals("2")) {
        val intent = Intent(instance, YOURACTIVITY::class.java)
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        instance.startActivity(intent)
      }
    } catch (e: JSONException) {
      Log.e("TAG", "notificationOpened: " + e);
      e.printStackTrace();
    }
  }
}
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, iZootoNotificationActionDelegate {
    
        func onOpenActionHandler(action: String) {
            print("Data",action)
        }
}
iZooto.shared.onNotificationOpened((data) {
    print('iZooto DeepLink Datadata : $data');
  });
componentDidMount() {
  iZooto.onNotificationOpenedListener(data => {
    console.log("iZootoExampleDeeplinkData", data); // THIS CAN BE CHANGED AS PER REQUIREMENT
  });
}

Notifications When App is Closed

Android

A normal close such as swiping your app away won't be an issue on most devices. However, force closing it through the app settings, task killer, or through Android Studio will result in most intents (including pushes) preventing services from starting.

Also, some Xiaomi and Huawei devices will put your app in a force-closed state after swiping it away or after some time. See the following documentation for more details on this and the logcat message to confirm this.

iOS

iOS devices will always receive notifications. They might be delayed, however, if the app is in Low Power Mode.