untiy实现android和ios端本地推送

原文地址:Unity 移动端通知推送功能实现 - Warren的文章 - 知乎

https://zhuanlan.zhihu.com/p/222015804


因为项目需求需要增加每天在指定时间推送通知,增加了如下函数

public static void SendRepeatNotification(string title,string text)

    {

        Init();

        DateTime now = DateTime.Now;

        AndroidNotification notification = new AndroidNotification

        {

            Title = title,

            Text = text,

            FireTime = new DateTime(now.Year, now.Month, now.Day, 12, 0, 0).AddDays(1),

            RepeatInterval = new TimeSpan(1, 0, 0, 0),

            IntentData = "{\"title\": \"Notification 1\", \"data\": \"200\"}",

            ShouldAutoCancel = true

        };

        AndroidNotificationCenter.SendNotification(notification, "channel_id");

    }

你可能感兴趣的:(untiy实现android和ios端本地推送)