首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Xamarin.iOS通知建议

Xamarin.iOS通知建议
EN

Stack Overflow用户
提问于 2017-10-14 18:45:41
回答 1查看 44关注 0票数 0

需要在Xamarin.iOS应用程序中显示通知。

应用程序在后台以一定的时间间隔调用web服务

还有更好的方法吗?

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2020-02-16 18:16:16

为此,您可以使用本地通知。您可以在调用web服务的地方使用以下代码:

//创建通知

代码语言:javascript
复制
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);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46743616

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档