我试图在我的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中进行设置,但这给了我一些错误:
此块在“应用程序”标签中
<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和已完成的操作
compile 'com.google.android.gms:play-services:4.3.23'
在build.gradle中<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
在AndroidManifest.xml中您能帮我指出我错过的地方吗?感谢您的帮助!
com.google.android.gcm.GCMBroadcastReceiver
是您的项目中可能没有的不推荐使用的类。您应该实现自己的广播接收器。GCMIntentService
是您应该实现的类。
您正在使用的旧教程使用了不推荐使用的类,而不是使用Google Play服务库。您应该参考当前的官方GCM演示应用程序,以查看清单的外观以及项目中应包含的类。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句