This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
mochapine64backup/MoCha/Assets/SimpleAndroidNotifications/NotificationExample.cs

53 lines
1.6 KiB
C#
Raw Normal View History

using System;
using UnityEngine;
namespace Assets.SimpleAndroidNotifications
{
public class NotificationExample : MonoBehaviour
{
public void Rate()
{
Application.OpenURL("http://u3d.as/y6r");
}
public void OpenWiki()
{
Application.OpenURL("https://github.com/hippogamesunity/SimpleAndroidNotificationsPublic/wiki");
}
public void ScheduleSimple()
{
NotificationManager.Send(TimeSpan.FromSeconds(5), "Simple notification", "Customize icon and color", new Color(1, 0.3f, 0.15f));
}
public void ScheduleNormal()
{
NotificationManager.SendWithAppIcon(TimeSpan.FromSeconds(5), "Notification", "Notification with app icon", new Color(0, 0.6f, 1), NotificationIcon.Message);
}
public void ScheduleCustom()
{
var notificationParams = new NotificationParams
{
Id = UnityEngine.Random.Range(0, int.MaxValue),
Delay = TimeSpan.FromSeconds(5),
Title = "Custom notification",
Message = "Message",
Ticker = "Ticker",
Sound = true,
Vibrate = true,
Light = true,
SmallIcon = NotificationIcon.Heart,
SmallIconColor = new Color(0, 0.5f, 0),
LargeIcon = "app_icon"
};
NotificationManager.SendCustom(notificationParams);
}
public void CancelAll()
{
NotificationManager.CancelAll();
}
}
}