How to Schedule a Remote Notification daily at certain time

Hello Everyone, From past 1 week im trying to find out about how to sent Remote Notifications to the ios and android using C# and Onesignal or else another service , when the game is not running in back ground or when game is not opened at all(just installed). I have searched everywhere but i didnt found answer. Thank you

What you want to implement are called push notifications. For iOS, you can follow the documentation guide. For Android, there is currently no out-of-the-box solution for implementing push notifications as different Android devices use different systems (e.g. Google’s GCM vs Amazon’s ADM). There are existing plug-ins for this, one example is UTNotifications.

Hi NCPLNaveen,

As far as I can say from your question, you don’t even need to use push (remote) notifications: just scheduled local ones are enough (and it’s much easier to implement local notifications). Both local and push notifications are designed to be delivered even if your app is not running (but it has to be run at least once by user, it’s a requirement of operating systems).
Unity, as brain56 correctly mentioned, provides notifications API only on iOS. For other platforms there is a number of plugins at unity asset store, f.e. our asset, mentioned by brain56 - UTNotifications (it supports both local and push notifications on iOS, Android, Amazon Android & WP).

Best regards,
Yuriy, Universal Tools team.

Hello, could you please provide with a basic script on how to activate daily notifications? Because on my app the push notifications are appearing EXCLUSIVELY when the app is being used. but it is annoying like this, and it is also pretty useless. I simply would like to remind my users to use my app DAILY, especially when they are NOT using it.

Thanks a lot to anyone willing to help me out :slight_smile:

using System.Collections;
using System.Collections.Generic;
using Unity.Notifications.Android;
using UnityEngine;

public class NotificationsManagerAndroid : MonoBehaviour
{

    public AndroidNotificationChannel defaultNotificationChannel;
    int identifier;

    void Start()
    {
        var defaultNotificationChannel = new AndroidNotificationChannel()
        {
            Id = "default_channel",
            Name = "Default Channel",
            Importance = Importance.Default,
            Description = "For Generic notifications",
        };
        AndroidNotificationCenter.RegisterNotificationChannel(defaultNotificationChannel);
        AndroidNotification notification = new AndroidNotification()
        {
            Title = "Thirsty Glass!",
            Text = "I am thirsty!",
            SmallIcon = "main_icon",
            LargeIcon = "app_icon_large",
            FireTime = System.DateTime.Now.AddSeconds(10), //.AddMinutes
        };
        identifier = AndroidNotificationCenter.SendNotification(notification, "default_channel");
        AndroidNotificationCenter.NotificationReceivedCallback receivedNotificationHandler = delegate (AndroidNotificationIntentData data)
        {
            var msg = "Notification received : " + data.Id + "
";
            msg += "
 Notification received: ";
            msg += "
 .Title: " + data.Notification.Title;
            msg += "
 .Body: " + data.Notification.Text;
            msg += "
 .Channel: " + data.Channel;
            Debug.Log(msg);
        };
        AndroidNotificationCenter.OnNotificationReceived += receivedNotificationHandler;
        var notificationIntentData = AndroidNotificationCenter.GetLastNotificationIntent();
        if (notificationIntentData != null)
        {
            Debug.Log("App was opened with notification!");
        }
    }
    private void OnApplicationPause(bool pause)
    {
        if (AndroidNotificationCenter.CheckScheduledNotificationStatus(identifier) == NotificationStatus.Scheduled)
        {
            //If the player has left the game and the game is not running. Send them a new notification
            AndroidNotification newNotification = new AndroidNotification()
            {
                Title = "Reminder Notification!",
                Text = "You've paused the game!",
                SmallIcon = "main_icon",
                LargeIcon = "app_icon_large",
                FireTime = System.DateTime.Now
            };
            // Replace the currently scheduled notification with a new notification.
            AndroidNotificationCenter.UpdateScheduledNotification(identifier, newNotification, "default_channel");
        }
        else if (AndroidNotificationCenter.CheckScheduledNotificationStatus(identifier) == NotificationStatus.Delivered)
        {
            //Remove the notification from the status bar
            AndroidNotificationCenter.CancelNotification(identifier);
        }
        else if (AndroidNotificationCenter.CheckScheduledNotificationStatus(identifier) == NotificationStatus.Unknown)
        {
            AndroidNotification notification = new AndroidNotification()
            {
                Title = "Thirsty Glass!",
                Text = "I am thirsty!",
                SmallIcon = "main_icon",
                LargeIcon = "app_icon_large",
                FireTime = System.DateTime.Now.AddSeconds(10),
            };
            //Try sending it again
            identifier = AndroidNotificationCenter.SendNotification(notification, "default_channel");
        }
    }
}

Did you ever get an answer for this? I am having the same exact issue right now.