重新安装应用程序时 Azure 通知中心失去订阅
Azure Notification Hub losing the subscribe when app is reinstalled
我遇到了 Azure 通知中心的问题。
当我的应用程序第一次启动时,通知工作正常,但是当 Visual Studio 重建应用程序时,通知停止工作并且 Android 带有 IntentFilters 的服务不工作打电话。
为了让通知再次生效,我需要再次 Visual Studio 卸载 Android 和 运行 中的应用程序。
有人知道这个问题吗?
我担心的是:如果我将应用程序发送到 GooglePlay,通知会在更新后继续工作吗?
如果有人知道如何调用服务来获取新的 InstallationId,总是要启动的应用程序,我就会知道如何解决问题。
有人可以帮助我吗?
我确实遵循了该教程:
https://www.youtube.com/watch?v=le2lDY22xwM&t=3312s
if I send the app to GooglePlay, the notifications would continue working after a update?
这个不用担心,参考这个document, when you use Azure Notification Hub
, it's using Android GCM
to send the push notificcation. You could see my answer about Android using Firebase Cloud Messaging not receiving message.
正如 Official document 所说:
On initial startup of your app, the FCM SDK generates a registration token for the client app instance. If you want to target single devices or create device groups, you'll need to access this token.
关于Token
的解释:
An ID issued by the GCM connection servers to the client app that allows it to receive messages.
当您通过 Visual Studio
重建应用程序时,您的令牌已更改,但它没有触发 OnTokenRefresh
方法,所以此时 Token
在您的申请中无效 。这就是您的应用程序无法接收消息的原因。
更多信息,您可以参考Sending Push Notifications from Azure Mobile Apps and Implement the Firebase Instance ID Service。
当您的应用程序获得更新时,它会自动触发 OnTokenRefresh
方法,因此您的应用程序仍然可以收到消息。
我遇到了 Azure 通知中心的问题。
当我的应用程序第一次启动时,通知工作正常,但是当 Visual Studio 重建应用程序时,通知停止工作并且 Android 带有 IntentFilters 的服务不工作打电话。
为了让通知再次生效,我需要再次 Visual Studio 卸载 Android 和 运行 中的应用程序。
有人知道这个问题吗?
我担心的是:如果我将应用程序发送到 GooglePlay,通知会在更新后继续工作吗?
如果有人知道如何调用服务来获取新的 InstallationId,总是要启动的应用程序,我就会知道如何解决问题。
有人可以帮助我吗?
我确实遵循了该教程: https://www.youtube.com/watch?v=le2lDY22xwM&t=3312s
if I send the app to GooglePlay, the notifications would continue working after a update?
这个不用担心,参考这个document, when you use Azure Notification Hub
, it's using Android GCM
to send the push notificcation. You could see my answer about Android using Firebase Cloud Messaging not receiving message.
正如 Official document 所说:
On initial startup of your app, the FCM SDK generates a registration token for the client app instance. If you want to target single devices or create device groups, you'll need to access this token.
关于Token
的解释:
An ID issued by the GCM connection servers to the client app that allows it to receive messages.
当您通过 Visual Studio
重建应用程序时,您的令牌已更改,但它没有触发 OnTokenRefresh
方法,所以此时 Token
在您的申请中无效 。这就是您的应用程序无法接收消息的原因。
更多信息,您可以参考Sending Push Notifications from Azure Mobile Apps and Implement the Firebase Instance ID Service。
当您的应用程序获得更新时,它会自动触发 OnTokenRefresh
方法,因此您的应用程序仍然可以收到消息。