Xamarin Android GCM 客户端不工作

Xamarin Android GCM Client does not work

我已经按照the Xamarin component store. Furthermore I have followed the tutorial on Notification Hub中的示例设置了GCM客户端。 我 运行 我在 Android 4.4.2 模拟器和 Google API 19 以及各种 android 设备(4.4、5.1)上进行了测试。我正在使用最新版本的 Xamarin。

在模拟器中调用了 PushHandlerService.OnRegistered,我可以在通知中心注册设备令牌。但是,我发送消息时没有调用PushHandlerService.OnMessage方法。

在真实设备上,甚至 PushHandlerService.OnRegistered 都不会被调用。

我已尝试通过通知中心和直接通过 GCM 服务 (HTTP Post) 发送消息。对服务的两次调用均成功,但消息未到达我的应用程序。当应用程序处于活动或关闭状态时,我已尝试使用通知 and/or 数据有效负载的通知消息。我将我的 google 帐户添加到模拟器中。我已经确保我的google项目号和包名是正确的(google开发者控制台对应app)。

如何进一步调查我的问题? 是否有可能在 GCM 中查看交付日志? 有没有办法查看通知消息是否至少到达了我的模拟器的操作系统? 会出现什么问题,导致我的模拟器收到注册 ID,但不是真实设备?

根据 Xamarin 教程,我终于得到了新的 GCM API:https://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/android/

此外,我在我们的防火墙上解锁了 GCM 端口::5228、5229、5230