【问题标题】:How to replace GCMBaseIntentService with an equivalent GoogleCloudMessaging methods如何用等效的 GoogleCloudMessaging 方法替换 GCMBaseIntentService
【发布时间】:2016-01-28 18:44:07
【问题描述】:

我正在努力将 2013 年的 Android 应用程序更新到新的 API 级别 23。从那时到现在,它似乎发生了很大变化。

我有一个 GCMIntentService 类,它扩展了 GCMBaseIntentService 并覆盖了它的具体方法:

  • onError()
  • onMessage()
  • onRegister()
  • onUnregister()

我知道它已被 GoogleCloudMessaging 类取代,但我在它的文档中看不到任何等效方法。这里还有一堆方法已被弃用。我不确定如何替换这些覆盖方法,任何帮助将不胜感激。

参考: https://developers.google.com/android/reference/com/google/android/gms/gcm/GoogleCloudMessaging#register(java.lang.String...)

【问题讨论】:

    标签: android android-intent android-studio google-cloud-messaging


    【解决方案1】:

    您可以查看Set up a GCM Client App,了解如何在 GCM 中设置 IntentService。

    由于它有点不同,您可能必须更改之前处理实现的方式。您基本上被要求创建一个 IntentService 并通过获取 InstanceId 来获取 onHandleIntent 中的注册令牌。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-03
      • 2016-12-09
      • 2012-09-04
      • 2012-09-27
      相关资源
      最近更新 更多