I am trying to use GoogleCloudMessaging (GCM) API for push notification in my Android app.
Referring to http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/ and http://developer.android.com/google/play-services/setup.html#Setup, I tried to set them up in AndroidManifest.xml but it gave me some error:
This block is in Application tag
<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" />
I am using Android Studio and what I have done
compile 'com.google.android.gms:play-services:4.3.23'
in build.gradle<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
in AndroidManifest.xmlCould you help me point out where I have missed? Thank for any help!
com.google.android.gcm.GCMBroadcastReceiver
is a deprecated class that you probably don't have in your project. You should implement your own broadcast receiver. GCMIntentService
is a class you are supposed to implement.
You are using an old tutorial that uses deprecated classes instead of using the Google Play Services library. You should refer to the current official GCM demo app to see how your manifest should look like and which classes should be in the project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With