Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity notification

//install "Mobile Notification" Asset
using Unity.Notifications.Android; //header for notification

public class Notification : MonoBehaviour
{
    public void NotificationSend()
    {
        AndroidNotificationChannel channelName = new AndroidNotificationChannel()
        {
            Id = "IdName",
            Name = "Default Channel",
            Importance = Importance.Default,
            Description = "Any discription",
        };
        AndroidNotificationCenter.RegisterNotificationChannel(channelName);

        Unity.Notifications.Android.AndroidNotification notificationName = new Unity.Notifications.Android.AndroidNotification
        {
            Title = "Notification Header",
            Text = "Notification Description",
            SmallIcon = "default",
            LargeIcon = "default",
            FireTime = System.DateTime.Now
        };

        AndroidNotificationCenter.SendNotification(notificationName, "IdName");
    }
}
 
PREVIOUS NEXT
Tagged: #unity #notification
ADD COMMENT
Topic
Name
6+8 =