Search code examples
androidpush-notificationandroid-c2dmxtify

how to get PAYLOAD value from xtify sdk in android?


i'm using new xtify sdk, in which i tried this below code,

  @Override
  public void onMessage(Context context, Bundle msgExtras) {
    Log.i(TAG, "-- Notification recived");
    Log.i(TAG, "Notification Title: "+ msgExtras.getString(NOTIFICATION_TITLE));
    Log.i(TAG, "Notification Content: "+msgExtras.getString(NOTIFICATION_CONTENT));
    Log.i(TAG, "Payload Data "+ msgExtras.getString("listing_id"));
    RichNotificationManger.processNotifExtras(context, msgExtras);
}

in msgExtra,getString("listing_id"), i 'm getting the null value.

Please tell me also that how to pass value of payload with key.

i tried in that,

   payload{"myKey":"myValue"}

Solution

  • In the website try to send the following json in the payload filed :

    {"listing_id":"my_listing_id"}
    

    And in the client side this is how you retrieve the data :

      @Override
      public void onMessage(Context context, Bundle msgExtras) {
     msgExtras.getString("listing_id")
    }
    

    If you're still having trouble with it, let me know.