【问题标题】:Firebase and Azure Scheduled notifications in XamarinXamarin 中的 Firebase 和 Azure 计划通知
【发布时间】:2018-09-30 16:08:43
【问题描述】:

我目前正在开发一个 xamarin.forms 应用程序,该应用程序使用 FireBase 和 Azure 通知中心向用户发送通知。使用 MessagingCenter 我在 xamarin.android 和 xamarin.forms 之间以及 xamarin.ios 和 xamarin.forms 之间传递数据。我的应用允许用户提醒何时服药。

我的问题是,有没有办法在指定时间激活通知?我知道我应该使用某种类型的任务或服务作为后台,但我找不到如何做到这一点。欢迎任何建议。谢谢。

【问题讨论】:

    标签: firebase xamarin.forms firebase-cloud-messaging azure-notificationhub


    【解决方案1】:

    当您将通知发送到 NotificationHub 时,您可以安排它在未来触发,如 this Microsoft documentation page 中所述:

    Notification notification = new AppleNotification("{\"aps\":{\"alert\":\"Happy birthday!\"}}");
    var scheduled = await hub.ScheduleNotificationAsync(notification, new DateTime(2014, 7, 19, 0, 0, 0));
    

    如果您通过服务器发送通知,您使用的服务器 SDK 应该具有等效方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-13
      • 2016-10-29
      • 1970-01-01
      • 2016-11-06
      • 1970-01-01
      • 2019-06-18
      • 2016-02-24
      • 2017-03-23
      相关资源
      最近更新 更多