【问题标题】:Azure Notification Hub losing the subscribe when app is reinstalled重新安装应用时 Azure 通知中心失去订阅
【发布时间】:2018-04-24 16:42:12
【问题描述】:

我在使用 Azure 通知中心时遇到问题。

当我的应用第一次启动时,通知正常工作,但当 Visual Studio 重新构建应用时,通知停止工作,并且不会调用带有 IntentFilters 的 Android 服务。

为了让通知再次生效,我需要在 Android 中卸载 App 并再次由 Visual Studio 运行。

有人知道这个问题吗?

我担心的是:如果我将应用程序发送到 GooglePlay,更新后通知会继续工作吗?

如果有人知道如何调用服务来获取新的 InstallationId,那么我总是知道要启动的应用程序如何解决问题。

有人可以帮我吗?

我确实遵循了该教程: https://www.youtube.com/watch?v=le2lDY22xwM&t=3312s

【问题讨论】:

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


    【解决方案1】:

    如果我将应用发送到 GooglePlay,更新后通知会继续有效吗?

    这个不用担心,参考这个document,当你使用Azure Notification Hub时,它使用Android GCM发送推送通知。你可以看到我对Android using Firebase Cloud Messaging not receiving message的回答。

    正如Official document 所说:

    在您的应用首次启动时,FCM SDK 会为客户端应用实例生成一个注册令牌。如果您想定位单个设备或创建设备组,则需要访问此令牌。

    关于Token的说明:

    GCM 连接服务器向客户端应用发出的 ID,允许其接收消息。

    当您通过Visual Studio 重建应用程序时,您的令牌已更改,但未触发OnTokenRefresh 方法,因此此时您应用程序中的Token 无效。这就是您的应用程序无法接收消息的原因。

    更多信息,您可以参考Sending Push Notifications from Azure Mobile AppsImplement the Firebase Instance ID Service

    当你的应用有更新时,它会自动触发OnTokenRefresh方法,所以你的应用仍然可以收到消息。

    【讨论】:

      猜你喜欢
      • 2018-04-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-12
      • 1970-01-01
      相关资源
      最近更新 更多