I am currently investigating in an online-offline-supported application and figuring out the usage of APNS, and it is quite easy to understand when my application only deals with single user.(just like SMS)
My understanding is, each application installed to the specific device will have its own device token (and which won't be changed even after unregistration to APNS and re-register again). So, when a user login from different devices, APNS and in turn the server can identify.
However, when I tried to implement a multiple account apps ( just like Facebook, that different people can login using same phone), some questions arose.
When user A logged in and when the app is in background state, yea it did receive the notification.
But when user A logged out (when the phone has no internet connection, which means can't update the server at once for deletion of account), and then user B logged in, meanwhile the server tried to push notification to the phone for user A, the notification has already received by the phone (but that's notification for user A) and user B would receive that (which should never happen in real scenario).
It seems that APNS cannot check in-application account authentication.
So, my questions are,
Is there any way to check and remove the notification on the phone (I've read the Apple Doc. and notice that there is a QoS storing the last notification)?
what is a good practice to handle such kind of authentication problems upon using APNS?
Please, if any, correct me if I do have any conceptual misunderstanding. And hope that my questions don't sound stupid and clumsy and there's not any question duplication ...