ios - Making sure the received push notification is for the right user -
take app e-mail client , gets push notifications when new e-mail has arrived.
how these apps make sure when push notification has arrived it's logged-in user?
for example, user logs-in user1 logs out , logs in user2. if push notification related new e-mail user1 arrives when user2 logged in?
from push notification communication mechanism point of view, possible. push notification can on way when user switches logins.
the problem on ios when new push notification has arrived, code doesn't called if app not in foreground.
this changed bit ios 7 (https://developer.apple.com/library/ios/releasenotes/general/whatsnewinios/articles/ios7.html#//apple_ref/doc/uid/tp40013162-sw10) yoru code gets called, push notification still displayed without code, meaning can't decide weather display or not. different android can decide.
this true, cannot catch notification before system, but... can instead send silent push notification, payload this:
{ "aps": { "content-available": 1 }, "user": "someuser", "alertmsg": "somemessage" } which trigger application:didreceiveremotenotification:fetchcompletionhandler: , give 30 seconds processing (if you're on background) without presenting alert. can check if logged-in user matches , if does, fire local notification information remote 1 (or data network call)
i hope makes sense...
Comments
Post a Comment