Google Cloud Messaging - GCM - SERVICE_NOT_AVAILABLE

后端 未结 6 1782
小蘑菇
小蘑菇 2021-02-04 00:28

I am trying, to implement the new GCM, I am following Google get stated : http://developer.android.com/guide/google/gcm/gs.html

I getting stuck at getting my de

相关标签:
6条回答
  • 2021-02-04 01:07

    The problem was not code related, but link to the test phone. The test phone do not have a SIM, and the clock was not set. So google cannot resgistred it with a wrong time.

    I manage to have a registration Id using a Android Virtual Device, with google api, and by setting the test phone clock.

    0 讨论(0)
  • 2021-02-04 01:11
    android:enabled="true"  
    

    Remove this ^

    If you don't already add this to your manifest

    <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="8"
    

    You don't need the second constructor in GCMIntentService. only this one

    public GCMIntentService() {         
     super(SENDER_ID);  }
    

    Ensure that your SENDER_ID is the number copied out of the URL from your browser while you are browsing the google code website AND browsing the GCM service.

    0 讨论(0)
  • 2021-02-04 01:11

    I've had this problem and it was caused by the WIFI connection. I turned WIFI off and made the test again (on 3g) and it Worked. Then I turned the WIFI back on and had the error again. Back to 3g, to make sure, and it worked again.

    So, in conclusion, the issue was caused by the connection.

    0 讨论(0)
  • 2021-02-04 01:15

    I had this problem running my application on genymotion. Installing google play services like it says here and everything worked fine.

    0 讨论(0)
  • Remember that if you're behind a corporate firewall, some ports that GCM uses may not be allowed to communicate over the local wireless. I had this problem when trying to get my emulator to work initially. I had to get a special IP that allowed the ports listed below through.


    Note: If your organization has a firewall that restricts the traffic to or from the Internet, you need to configure it to allow connectivity with GCM in order for your Android devices to receive messages. The ports to open are: 5228, 5229, and 5230. GCM typically only uses 5228, but it sometimes uses 5229 and 5230. GCM doesn't provide specific IPs, so you should allow your firewall to accept outgoing connections to all IP addresses contained in the IP blocks listed in Google's ASN of 15169.

    http://developer.android.com/google/gcm/gcm.html

    0 讨论(0)
  • 2021-02-04 01:26

    I had this problem...my solution was to disable internet connection and use the phone service.

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