com.google.android.gcm.GCMBaseIntentService在哪里?

Tax*_*Noi 10 android google-cloud-messaging

我在这里关注GCM教程http://developer.android.com/guide/google/gcm/gs.html

第2步的第 5点,它说:

添加以下intent服务:service android:name =".GCMIntentService"

此意图服务将由GCMBroadcastReceiver(由GCM库提供)调用,如下一步所示.它必须是子类com.google.android.gcm.GCMBaseIntentService,必须包含公共构造函数,并且应该命名my_app_package.GCMIntentService(除非您使用它的子类GCMBroadcastReceiver重写用于命名服务的方法).

但是,我不能子类com.google.android.gcm.GCMBaseIntentService,导入无法解决.我该如何解决?

chr*_*lri 12

您必须安装库:http://developer.android.com/guide/google/gcm/gs.html#libs

在SDK Manager中,安装Extras>适用于Android库的Google Cloud Messaging.这下YOUR_SDK_ROOT /演员/谷歌创建一个GCM目录/含这些子目录:GCM客户端,GCM服务器,样本/ GCM-演示客户端,采样/ GCM-演示服务器,和采样/ GCM-演示AppEngine上.

  • Google Cloud Messaging已弃用!它现在是Google Play服务 (7认同)
  • 有时,在安装Google Cloud Messaging for Android Library后,问题仍然存在.您必须手动将`gcm.jar`添加到Build Path (3认同)