【发布时间】:2014-06-24 10:34:45
【问题描述】:
我正在尝试在我的 Android 应用程序中使用 GoogleCloudMessaging (GCM) API 推送通知。
参考http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/ 和http://developer.android.com/google/play-services/setup.html#Setup,我尝试在AndroidManifest.xml 中设置它们,但它给了我一些错误:
- 无法解析符号“GCMBroadcastReceiver”
- 无法解析符号“GCMIntentService”
这个块在应用标签中
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.zaqqle.disqover" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
我正在使用 Android Studio 以及我做了什么
- 在 SDK 管理器中安装了 Google Play 服务并与 Gradle 同步
- 在 build.gradle 中包含
compile 'com.google.android.gms:play-services:4.3.23' - 在 AndroidManifest.xml 中包含
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
您能帮我指出我遗漏的地方吗?感谢您的帮助!
【问题讨论】:
标签: android push-notification google-cloud-messaging