GCMRegistrar cannot be resolved

后端 未结 4 2105
说谎
说谎 2021-01-06 06:40

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

相关标签:
4条回答
  • 2021-01-06 07:13

    GCMRegistrar GCM API is deprecated.It is recommended to refer updated documentation on Google developer Site

    0 讨论(0)
  • 2021-01-06 07:22

    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: enter image description here

    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

    0 讨论(0)
  • 2021-01-06 07:34

    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

    0 讨论(0)
  • 2021-01-06 07:39

    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

    0 讨论(0)
提交回复
热议问题