Send Repeat Notification

Description

Schedule a notification that repeats periodically.

Declaration

  public static void SendRepeatNotification(string title, string text, System.TimeSpan timeDelayFromNow, System.TimeSpan? repeatInterval, string smallIcon = null, string largeIcon = null, string customData = "")

Parameters

Name
Description

title

Title of the notification.

text

Content of the notification.

timeDelayFromNow

A delay to display the notification, this delay will be added to the current time.

repeatInterval

Time until the next notifications will be sent.

smallIcon

Name of the custom small icon from Mobile Notification Settings.

largeIcon

Name of the custom large icon from Mobile Notification Settings.

customData

This data can be retrieved if the users opens app from notification.

Example

public class Test : MonoBehaviour
{
    private void OnApplicationFocus(bool focus)
    {
        if (focus == false)
        {
            Gley.Notifications.API.SendRepeatNotification("Game Title", "App was minimized", new System.TimeSpan(0, 0, 10), new System.TimeSpan(0, 0, 30), "icon_0", "icon_1", "Opened from Gley Minimized Notification");
        }  
    }
}

This displays a notification after 10 seconds after the app was minimized and it is sent automatically again at every 30 seconds.

icon_0 & icon_1 are the names given to your icons in the Android Window.

For iOS icons are not required as parameters, so you can use null, like this:

public class Test : MonoBehaviour
{
    private void OnApplicationFocus(bool focus)
    {
        if (focus == false)
        {
            Gley.Notifications.API.SendRepeatNotification("Game Title", "App was minimized", new System.TimeSpan(0, 0, 10), new System.TimeSpan(0, 0, 30), null, null, "Opened from Gley Minimized Notification");
        }  
    }
}

Last updated