在GCM DOCS的快速入门示例中找不到GcmReceiver类

时间:2015-12-08 08:40:06

标签: java android google-cloud-messaging android-manifest

我正在尝试使用GCM开发应用,

所以我在这里下载了Google制作的Sample项目 :https://developers.google.com/cloud-messaging/android/start

在这个项目的清单中,下面有GcmReceiver的代码:

        <!-- [START gcm_receiver] -->
    <receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="gcm.play.android.samples.com.gcmquickstart" />
        </intent-filter>
    </receiver>
    <!-- [END gcm_receiver] -->

但是在java包中,下面没有名为GcmReceiver的类是我给我看的示例项目的图片: enter image description here

只是使用清单xml文件,GcmReceiver是否运行良好?

1 个答案:

答案 0 :(得分:0)

您必须至少将Play Services 7.5.0添加到您的项目中。 我建议你添加最新的库vs 8.3.0

以下是gradle用户的链接:

compile "com.google.android.gms:play-services:8.3.0"
相关问题