android - GCM 是否需要 google play services 应用程序才能工作?

标签 android android-emulator android-logcat google-cloud-messaging

我试图在 Eclipse 上运行 Google Cloud Messaging 代码。错误 SERVICE_NOT_AVAILABLE 出现在模拟器和运行 2.2 的平板电脑上。

所以在网上看了一段时间后,我在我的代码中包含了 isGooglePlayServicesAvailable() 检查,它返回状态代码 1,意思是 SERVICE_MISSING。

我从 developer.android.com 文档中了解到这一点

要在使用 Google Play 服务 SDK 时测试您的应用,您必须使用:

  • 一台运行 Android 2.2 或更高版本并包含 Google Play 商店的兼容 Android 设备。
  • 带有 AVD 的 Android 模拟器,运行基于 Android 4.2.2 或更高版本的 Google APIs 平台。

所以我的问题是,要注册具有 Google Play 应用程序的 android 2.2 设备,是否也需要 Google play 服务? 由于我的平板电脑在 android 2.2 上运行,带有 google play 应用程序但没有 google play 服务,而且我运行的模拟器低于 4.2.2,这就是 GCM 给出 SERVICE_NOT_AVAILABLE 错误的原因。 我也没有在 Logcat 中看到任何其他错误。

如有任何帮助,我们将不胜感激。 谢谢

最佳答案

So my question is that for registering an android 2.2 device which has a Google Play app, is Google play services required as well?

如果您要使用 GoogleCloudMessaging,我的理解是,您需要 Play 服务。不使用 GoogleCloudMessaging 类的旧版 GCM API 应该可以在没有 Play 服务的设备上运行,因为它在 Google I|O 2013 之前就可以在此类设备上运行,当时没有 GoogleCloudMessaging 类。

关于android - GCM 是否需要 google play services 应用程序才能工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18035001/

相关文章:

android - android应用程序中的按钮导致空指针错误

android - 在 IntelliJ 中运行多平台 Kotlin 测试产生 No JDK specified 错误

android - 如何在 android 中为所有版本设置模糊图像?

java - NullPointerException - 位置为空?

linux - 模拟器在内核镜像文件中找不到 'Linux version ' 字符串

android - 日志的相当奇怪的行为

android-ndk - android中的设备管理员

Android模拟器实际屏幕尺寸

java - 使默认的android模拟器更快

java - 为什么我在 IntelliJ logcat View 中看不到任何错误?