HTTP Status Code: 401 in GCMDemo

前端 未结 1 607
广开言路
广开言路 2020-12-06 06:51

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

Server 401 when trying to send a message to my android device.

HTTP Status 500 - HTTP Sta         


        
1条回答
  •  日久生厌
    2020-12-06 07:29

    You should take a look at the GCM docs where it explains the GCM response: http://developer.android.com/google/gcm/gcm.html#response and troubleshooting the 401 error code: http://developer.android.com/google/gcm/gcm.html#auth_error

    Description from the docs:

    Authentication Error The sender account that you're trying to use to send a message couldn't be authenticated. Possible causes are:

    Authorization header missing or with invalid syntax.

    Invalid project number sent as key.

    Key valid but with GCM service disabled.

    Request originated from a server not whitelisted in the Server Key IPs.

    So I would check to make sure that you are setting you authorization header properly and that you Google Project number is properly setup with GCM and accepting your servers IP.

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