需要在Xamarin.iOS应用程序中显示通知。
应用程序在后台以一定的时间间隔调用web服务
还有更好的方法吗?
提前感谢!
发布于 2020-02-16 18:16:16
为此,您可以使用本地通知。您可以在调用web服务的地方使用以下代码:
//创建通知
var notification = new UILocalNotification();
// set the fire date (the date time in which it will fire)
notification.FireDate = NSDate.FromTimeIntervalSinceNow(60);
// configure the alert
notification.AlertAction = "View Alert";
notification.AlertBody = "Your one minute alert has fired!";
// modify the badge
notification.ApplicationIconBadgeNumber = 1;
// set the sound to be the default sound
notification.SoundName = UILocalNotification.DefaultSoundName;
// schedule it
UIApplication.SharedApplication.ScheduleLocalNotification(notification);https://stackoverflow.com/questions/46743616
复制相似问题