Xamarin/Azure 发送后删除了通知中心 GCM 注册

Xamarin/Azure Notification Hubs GCM registration removed after sending

我有一个使用 GCMClient library as recommended in the Azure tutorials 的 Xamarin Android 应用设置。通过 Azure 门户(或 Azure VS 插件)从代码发送通知或测试通知时,设备注册将被删除,并从 Azure 通知中心收到以下响应:

The Push Notification System handle for the registration is no longer valid

我已经注释掉了应用程序中取消订阅注册的所有代码,在具有 Google API 和物理 Nexus 设备的模拟器上尝试了 运行 和物理 Nexus 设备调试& 释放模式,但无论何时发送通知,注册都会被删除。

我还配置了一个现有的 Web 应用程序以使用相同的 Azure 通知中心;该 Web 应用程序使用 Chrome 的 Web 推送通知和服务工作者,它运行良好,注册永远不会从通知中心删除,并且每次都会收到测试消息。

我验证了正常的;发件人 ID 和 Azure NH 连接字符串都正确...

需要检查的几件事:

  1. 您能否检查一下您为 GCM 设置的凭据是否正确。 使用这个 link: https://docs.microsoft.com/en-us/azure/notification-hubs/xamarin-notification- hubs-push-notifications-android-gcm

  2. 确保每次打开应用程序时使用最新的设备令牌进行注册,以确保注册是最新的。

我假设在您发送通知之前注册已经存在。但为了确保,请使用 Visual studio 服务器资源管理器检查您的注册 ID 见 link Verify Registrations