androidxmppopenfirewebsub

Delete or update payload item in pubsub


I have one problem, I need to delete payload item from pubsubitem table from database programmatically according to jid.I'm using openfire and smack api.

It work like everytime when i call leaf.send or publish everytime new entry is added in database.

So, I need to that entry update or delete old one and add new.But not getting any idea how can i do it.Any help appreciated. thanks

 leaf.deleteItem(leaf.getSubscriptions().get(0).getJid().toString());

 leaf.publish(new PayloadItem("Chandigarh" + "*" + System.currentTimeMillis(),new SimplePayload("Online", "stage:pubsub:simple",
                                                                        "<book xmlns='" + sharedPreferences.getString("user_id", "") + "," + gpsTracker.getLatitude() + "," + gpsTracker.getLongitude() + "'><title>" + "Offline user" + "</title></book>")));

Solution

  • This is possible by two ways,

    1. updation of any record :

    If payload item ID is same then automatically updation handled by system.

    1. Delete is also work but you should pass same payload id to delete particular payload item.

    thankyou