I\'m trying to implement Push Notification. I have a problem with import com.google.android.gcm.GCMRegistrar
it cannot be resolved.
I did install
GCMRegistrar GCM API is deprecated.It is recommended to refer updated documentation on Google developer Site
First of all download Google Cloud Messaging for Android Library
. For this goto Android SDK Manager->Extras->Google Cloud Messaging for Android Library
check and install it.
See the below image:
Now, after downloading this libary you'll see gcm
folder is available into path D:\.....\android-sdk\extras\google
Now You'll find gcm.jar
into path D:\....\android-sdk\extras\google\gcm\samples\gcm-demo-client\libs
.
Now, add this gcm.jar
file into your project
You need to copy the library - "gcm.jar" in folder - "libs". Look at this example and take out library - http://www.androidhub4you.com/2013/04/google-cloud-messaging-example-in.html
Our Google overlords have decried that gcm.jar is deprecated as of Summer 2013 so whatever example code you're working off that requires GCMRegistrar.java is a bit outdated. Of course, just adding gcm.jar works well as stated in the other answers.
If you want to follow Google's commands for whatever reason, CommonsWare has an updated GCM example project that basically just copies the needed classes from gcm.jar and renames them with a 'compat' suffix:
https://github.com/commonsguy/cw-omnibus/tree/master/Push/GCMClient2/src/com/commonsware/android/gcm/client