Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keeping track of active users for push notifications with Urban Airship

We are currently implementing push notifications (for IOS only for now), and we are planning on using Urban Airship. We want to send a push message to a device if they have our app installed and push enabled, and send an SMS message if not. Our users pay for the notifications, so we want to make sure as much as possible that they always get either a push message or a SMS message. Sending the push messages itself works fine, but I am confused about how to keep track of who we can actually send push messages to.

As far as I know, the only way to really making sure if a user can receive push messages is to, before sending a push message, make an additional call to the urban airship api to check if the device exists and is active. I would prefer to not do 2 api calls for each push message, so an alternative could be to keep track of all registered devices in urban airship locally, and update that list once per hour or so. However, this would mean the 'active devices list' is not always completely accurate, and that we have to keep track of all registered devices ourselves, which feels like re-implementing a part of urban airship.

Is there any other (better) way to do this? As far as I can see, when I send a push message to urban airship the api always returns that it was sent succesfully, regardless of whether or not a device is active, or if it even exists.

I can't imagine that I am the only one with this problem. Does anyone have a better way of solving it, or am I stuck with the 2 options that I figured out myself?

like image 749
Dennisch Avatar asked Oct 30 '13 14:10

Dennisch


1 Answers

Urban Airship shares the following two options:

In any case, applications should expect and handle inactive device tokens properly. We recommend that developers either:

  1. Register the device token every time the application is opened, like our sample app does
  2. Use our feedback API regularly, store inactivated device tokens in your own database, and send registrations when the device token becomes active again.

If you make an additional call to the Urban Airship to check if the device exists and is active, even then the 'active devices list' may not always be completely accurate because Urban Airship relies on periodic updates from Apple Feedback Service:

Apple tells us that the application has been uninstalled via the feedback service, which we check on a regular basis.

Also, do remember what Apple has stated about the delivery of Push Notifications:

Important: Delivery of notifications is a “best effort”, not guaranteed. It is not intended to deliver data to your app, only to notify the user that there is new data available.

like image 65
Aziz Shaikh Avatar answered Sep 25 '22 21:09

Aziz Shaikh