GCMRegistrar could not be resolved

I am trying to implement Push Notification. I have a problem with import com.google.android.gcm.GCMRegistrar, it cannot be solved.

I installed Google Play Servicesand will add google-play-services_libto my projects folder.

But the problem remains. I tried to find gcm.jaras I saw solutions that worked for others, but I don't have this .jar.

Is there anything else I am missing?

+4
source share
4 answers

Download first Google Cloud Messaging for Android Library. To do this, goto Android SDK Manager->Extras->Google Cloud Messaging for Android Librarycheck and install it.

See image below: enter image description here

Now, after loading this library, you will see a folder gcmaccessible in the pathD:\.....\android-sdk\extras\google

Now you will find gcm.jarthe way D:\....\android-sdk\extras\google\gcm\samples\gcm-demo-client\libs.

gcm.jar

+9

GCMRegistrar GCM API . Google

+5

Google , gcm.jar 2013 , , , GCMRegistrar.java . , gcm.jar , .

If you want to follow Google’s commands for any reason, CommonsWare has an updated GCM sample project that basically just copies the necessary classes from gcm.jar and renames them with the suffix:

https://github.com/commonsguy/cw-omnibus/tree/master/Push/GCMClient2/src/com/commonsware/android/gcm/client

+1
source

Source: https://habr.com/ru/post/1525398/


All Articles