Community

Community Forums

Where our customers, developers, and more can come together to help each other with both general and technical questions about our products and services.

Message Center messages list is empty after uninstalling and reinstalling the App for same user in Android

Sarah Garcia

Hi,

We have integrated Urban Airship SDK and enabled push notification. We are using message center feature for messages. Push notification and messages are being received as expected. We have enabled named user also to be in sync between different devices of same user. But if we uninstall the app and reinstall the same app and login as same user, the message center messages are not retained in Android. Instead, we are seeing empty message center after reinstall for same user. But, the iOS app is retaining the messages for the same user even if the app is uninstalled and installed again. Is this a limitation in android or Is there a way to retain the messages for the same named user in the same device in android?

Below is the code snippets we are using for named user. Immediately after user logs in to the app successfully, we register the named user.

UAirship.shared().getNamedUser().setId( <our unique user identifier> );
UAirship.shared().getNamedUser().forceUpdate();

When user logout of the app, we are removing the named user using the below code:

UAirship.shared().getNamedUser().setId(null);
UAirship.shared().getNamedUser().forceUpdate();

However, in the above scenario we are not even doing logout of the user. Instead, we uninstalled the app after user logged in successfully. Please let us know if there is anything wrong with what we are doing and if there is a way to achieve this?

Please sign in to leave a comment.

0
Avatar

Hi Sarah,

The behavior you're describing is expected on Android.

Message Center is integrated at a device level. This means, any messages in the Message Center are tied to the device, not the user.

The way we handle this on iOS is by associating the Message Center to the Channel Id on iOS. We store records of the Channel Id in the iOS keychain, which is generally retained from uninstall to reinstall. So, you would expect your messages to stay on iOS.

However, Android has no such feature. As a result, the Channel Id and any other information about that app or device is cleared on an uninstall. When you reinstall, it's as if you were installing the app for the first time resulting in a new Message Center and new Channel Id.

Michael Halka 0 votes
Comment actions Permalink
0
Avatar

Hi Michael,

I hope the messages would be retained in case of an upgrade of the app rather than uninstall-reinstall since the channel id is not changing. Can you please confirm this?

Also, I feel like this behavior of loosing the messages between uninstall and reinstall is bit awkward. Consider the scenario of a user changing his/her phone from an old one to a new model. All the unread past messages would also be lost which may not be so user friendly. Since you have introduced the named user concept to manage a user's multiple devices, I feel this concept should take care of retaining the messages and its read/unread status across devices and across uninstall-reinstall for the same named user. Hope you will consider this in your subsequent releases.

Sarah Garcia 0 votes
Comment actions Permalink
0
Avatar

Sarah,

Messages would be retained after an app upgrade, since you're not wiping app data when an app is updated.

We do hear you loud and clear though, having the Message Center tied to the Named User, rather than device, would make a lot more sense and would allow users to retain their messages between uninstall and reinstall and keep the messages list consistent across multiple devices. While we do not have that now, we will definitely work towards changing that behavior!

Michael Halka 0 votes
Comment actions Permalink