how to get PAYLOAD value from xtify sdk in android?

649 views Asked by At

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"}
2

There are 2 answers

1
Feras On BEST ANSWER

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.

0
user3486184 On

With Xtify 2.0, send the following JSON:

{"listing_id":"my_listing_id"}

and on the client side use:

msgExtras.getString("data.listing_id");