This is an update to my previous question, XMPP push notifications causing problems.
Thanks to the answer from Mickaël Rémond delay and duplication issues are gone but I still fail to understand the behaviour of push notifications.
If I move the app to background (without locking device or termination) it won't receive any push notifications, and when I bring it back to foreground all the messages are received perfectly.
When the app is in foreground and I lock the device, no notifications are triggered but messages are received perfectly.
When the app is in background and I lock the device, notifications are triggered, messages are received perfectly but sometimes messages are received after sending
sendLastActivityQueryToJID
.
I don't know what's going on here but if you guys have any idea please let me know.
PS i have removed Background modes form my app.