【问题标题】:Xamarin Android GCM Client does not workXamarin Android GCM 客户端不起作用
【发布时间】:2016-04-07 16:26:26
【问题描述】:

我已经按照the Xamarin component store中的例子设置了GCM客户端。此外,我遵循了Notification Hub 上的教程。 我在带有 Google API 19 的 Android 4.4.2 模拟器和各种 Android 设备(4.4、5.1)上运行我的测试。我正在使用最新版本的 Xamarin。

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

在真实设备上,甚至没有调用 PushHandlerService.OnRegistered。

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

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

【问题讨论】:

    标签: android azure notifications google-cloud-messaging xamarin.android


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-19
      • 1970-01-01
      • 1970-01-01
      • 2016-12-29
      相关资源
      最近更新 更多