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

后端 未结 3 839
爱一瞬间的悲伤
爱一瞬间的悲伤 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

    This is what I did to get the data ...I think this will help you..

    This is the response I am getting from UrbanAirship push notification.

    Bundle[{com.urbanairship.push.ALERT=, content-available=1, newscategorycode=O21R97, priority=5, com.urbanairship.push.PUSH_ID=afc9e690-f308-11e4-af8c-001018957618, id=6534.0, from=966150816212, func=News, newscategory=HR, com.urbanairship.push.APID=28e48c60-324b-456c-95b5-8fde9ab1a956, collapse_key=do_not_collapse, com.urbanairship.push.CANONICAL_PUSH_ID=7641453d-9207-4213-81c0-404387583de7}]

    Solution:

        Bundle bundle = message.getPushBundle();
    

    in your case get the bundle object then use like this...

        String func = bundle.getString("func");
        String newscategory = bundle.getString("newscategory");
        String sinceId = bundle.getString("id");
    

    you will get the data..

    Happy coding!

提交回复
热议问题