Server side GCM returns error 400

后端 未结 1 1192
别跟我提以往
别跟我提以往 2021-01-25 16:25

I am tring to implement GCM. I wrote a test code to understand how it works, but I keep getting error 400 in the response.

I\'m writing in Java (JDK 7).

I follow

相关标签:
1条回答
  • 2021-01-25 16:44

    The problem was in DataOutputStream.writeChars() and DataOutputStream.writeUTF().

    Thanks to the link given by @Koh, I changed the write command in the post function to:

    wr.write(json.getBytes("UTF-8"));
    

    Now the message is being sent successfully!

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