美文网首页
untiy实现android和ios端本地推送

untiy实现android和ios端本地推送

作者: 小歇 | 来源:发表于2022-02-17 11:01 被阅读0次

原文地址: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端本地推送

      本文链接:https://www.haomeiwen.com/subject/csnjlrtx.html