使用ACR通知插件在Xamarin中进行本地通知

3

我正在使用Xamarin的ARC通知插件创建一系列通知,但是尽管我至少将日期和时间设置为距离当前日期至少一天,所有的通知都会在打开应用后立即发送。我的问题是,我该如何设置通知模型,以便在指定的日期/时间接收通知?

var notif = new Notification(){
        Id = count++,
        Date = item.PostDate.Date,
        Title = item.Type.Equals(DayType.Duminica)
            ? item.Title
            : $"{item.Title} {Helpers.GetCurrentDateOldFormat(item.PostDate.AddDays(-13))}",
        Message = item.Content,                                
        When = App.Settings.NotificationTime // new TimeSpan(08, 00, 00)
};

它是 ARC 还是 ACR 通知? - ADimaano
1个回答

1

试试这个,它会对你有所帮助。

发送定时通知:

App.Settings.NotificationTime = TimeSpan.FromDays(50); 

var id = await CrossNotifications.Current.Send(
    item.Type.Equals(DayType.Duminica) ? item.Title : $"{item.Title} {Helpers.GetCurrentDateOldFormat(item.PostDate.AddDays(-13))}",
    item.Content,
    when = App.Settings.NotificationTime);

获取更多信息请点击这里


感谢您的回复。我们已经迁移至推送通知,这是一个更好的选择。 - ORober
你如何设置通知的时间? - sebastian.roibu

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接