Handling multiple users on a same device for the message center


I'm currently integrating the Message Center into my iOS app (Swift). I'm simply displaying it using UAirship.defaultMessageCenter.display(). So far, so good.

I noticed though that it doesn't seem to be in sync with the current user logged in my app. As an example, every time a user signs in / signs out, I update UAirship.namedUser().identifier with either "nil" if the user just logged out or with a user ID if a user logged in, this then allows me to target specific users for push notifications etc. 

And this is the problem I have with the Message Center:

  1. The user launches the app for the first time, he logs in on our platform, retrieves a used ID that I pass to the Urban Airship SDK via: "UAirship.namedUser().identifier", accepts Push Notifications etc.
  2. I then send him a message (delivered via a Push Notification or an In-App Message) from the Urban Airship dashboard, targeting this specific user ID.
  3. The user receives the message, it sits in the Message Center on his device.
  4. The user logs out, another logs in on the device, we pass a different user ID to the Urban Airship SDK.
  5. The new user browses the Message Center and still sees messages from the previous user. Even after deleting / reinstalling the app

Is there a way to reset / clear and link the Message Center to the current user logged in my app? I would have though that would happen under the hood by setting a unique identifier to UAirship.namedUser().identifier


Didn't find what you were looking for?

New post


1 comment

  • Hello,

    This is Sean with Urban Airship Technical Support.

    Unfortunately, our Message Center as designed is tied to the device, not the Named User.

    Push Notifications and Message Center Messages that target the Named User will be delivered the device, and Message Center Messages will remain in the Message Center for that device.

    Please let me know if you have any other questions or concerns.

    Thank you,
    Sean Conlin
    Urban Airship Technical Support
    Portland, Oregon

    Comment actions Permalink

Please sign in to leave a comment.