Enterprise app iOS device tokens remain active and working between installs.

I know device tokens remaining active after an uninstall is expected but the unexpected part of this is that the device tokens will still send pushes after reinstalls. Here is the scenario: 

I have recorded the deviceToken of an existing app install using Urban Airship. Then deleting the app and reinstalling, I recorded the new device token as well. These tokens are different. From the UA test panel, I am able to send a test push to both of these tokens and the device receives 2 pushes, one for each token, even though the first token has since been uninstalled. But, in UA device lookup, both tokens are marked as active.

Currently, on one development device, I am receiving up to 8 pushes at a time and all previous tokens remain active. What exactly will cause one of these tokens to go inactive? I have found this list but it does not seem to apply here: http://docs.urbanairship.com/reference/troubleshooting/ios-push.html#inactive-device-token

Is there any recommendation for unregistering from push notifications before an uninstall? Obviously, we cannot manually unsubscribe on the app uninstall event. Also want to remain subscribed between sessions of the same install. I thought of storing the original device token in the device keychain to persist it between installs and updating it when necessary but that is not a very straight forward solution or friendly solution.

The app is built with an enterprise profile. Additional info can also be found here: http://stackoverflow.com/questions/40408872/urban-airship-device-tokens-remain-active-between-installs

Didn't find what you were looking for?

New post



  • Hello pdycus! 

    I was able to look, and I'm seeing a lot of your push requests are actually being made within milliseconds of each other, with the same alert. If that is the case, you are definitely going to receive all of those messages at the same time.

    Also, be sure that you're not registering for push notifications twice in your app. This is a known issue on iOS where, if you register for push notifications twice, you can receive a message multiple times. Since Urban Airship handles this registration in the app for you, you don't need to perform that extra step.

    Comment actions Permalink
  • Thanks for the help Michael. We have implemented your suggestion as well as took a look at our current push notifications subscriptions on our server. We are now cross checking these subscriptions with the feedback API provided by Urban Airship. But it appears that we are still encountering some of this.

    The feedback API is the most reliable way to check the active state of a device token, correct? I am still encountering multiple notifications unless I do the following:
    1. Uninstall app
    2. Attempt to send push to uninstalled device token. Uninstalled device tokens are marked as not active.
    3. Prune non active device tokens stored on server using the feedback API.

    But if I were to skip step 2, all device tokens associated with my app are never considered non active tokens and will still successfully send pushes to the device. There is a recommendation in the UA docs that cross referencing the server db with the feedback API should be enough in most cases. But what it seems to me is that if an app is uninstalled and then reinstalled (and both times allow push notification permissions) within one day or before the server next attempts to send a push and then check the feedback API, then the device will start to receive multiples of the same notification. 

    In my SO link in the original post, someone recommended I check the channel id if I can use that to not duplicate a device on the server even though its device token is different. I will be looking into that today and tomorrow. Any other recommendations? Thanks again!

    Comment actions Permalink
  • I would definitely follow the suggestion that the person on the SO forum posted.

    Being able to see the device registration info and the like will help us figure out whats going on.

    Although what you're experiencing is not a crash, sending us the info in our Troubleshooting guide will help us do some investigation on our side and we'll be able to suggest some possible solutions from there.

    Comment actions Permalink

Please sign in to leave a comment.