Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where is com.google.android.gcm.GCMBaseIntentService?

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?

like image 990
EyeQ Tech Avatar asked Jul 13 '12 14:07

EyeQ Tech


2 Answers

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.

like image 155
chrulri Avatar answered Sep 20 '22 21:09

chrulri


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

like image 45
Usman Sharif Avatar answered Sep 21 '22 21:09

Usman Sharif