(New) GCM message received, but how to parse?

后端 未结 3 824
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-13 11:43

I am working with the \"new\" GCM, part of Google Play Services, that does not use jars for both Android and server. Android uses Google Play apk to register, receive and even s

3条回答
  •  失恋的感觉
    2021-02-13 12:15

    Is there a way to get, in Android end, payload information the way I've sent to GCM server?

    Rather than thinking "JSON", think "key/value pairs". Your server sends data in key/value pairs. Your app receives that data as key/value pairs in the extras in the Intent. You know what your keys are, so just retrieve the values out of the extras that are tied to those keys (e.g., getStringExtra("message"), getStringExtra("url")).

    Or should I parse received data in Android without JSON?

    The received data is not in JSON.

提交回复
热议问题