I'm following the tutorial on GCM here http://developer.android.com/guide/google/gcm/gs.html
At point 5 of Step 2, it says:
Add the following intent service: service android:name=".GCMIntentService"
This intent service will be called by the GCMBroadcastReceiver (which is is provided by GCM library), as shown in the next step. It must be a subclass of com.google.android.gcm.GCMBaseIntentService
, must contain a public constructor, and should be named my_app_package.GCMIntentService
(unless you use a subclass of GCMBroadcastReceiver
that overrides the method used to name the service).
However, I can't subclass com.google.android.gcm.GCMBaseIntentService
, the import can't be resolved. How do I fix this?
You have to install the libraries: http://developer.android.com/guide/google/gcm/gs.html#libs
From the SDK Manager, install Extras > Google Cloud Messaging for Android Library. This creates a gcm directory under YOUR_SDK_ROOT/extras/google/ containing these subdirectories: gcm-client, gcm-server, samples/gcm-demo-client, samples/gcm-demo-server, and samples/gcm-demo-appengine.
Download gcm.jar
from here and place it in YOUR_PROJECT/app/libs
directory
and then add compile files('libs/gcm.jar')
line in build.gradle
file
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