Urban Airship iPhone Framework

Our iPhone application The Now is a tool to help people live more mindfully.  The Now accomplishes this using a technique called continuous mindfulness training.  The process works by using periodic cues, in this case, free iPhone push notifications with an audible chime and relevant message, to remind you to be fully focused on the present.  When we started creating The Now we researched what was involved in adding push notification support to the app.  The standard method involves setting up your own complex push notification server, which then communicates with Apple’s push servers.  This seemed like overkill for the limited scope of our push notification usage, so we started exploring third party push notification services.  We discovered and settled on using Urban Airship’s push notification service.  

Urban Airship is a great startup company based in Portland, Oregon.  They offer services to simplify including push notifications and in-app purchases in your iPhone app.  Urban Airship provides a nice coding example for basic push notification usage.  However, in our case we wanted to schedule multiple push notifications over a three to four week period and the basic approach didn’t really suit our needs.  We open sourced our internal push notification framework, Suburban Airship, that allows you to use Urban Airship’s push notification service with only a few lines of code.  Feel free to use, modify it, etc however you would like.  It is really easy to use and the interface is pretty self explanatory.


#pragma Registration Method
- (void)putDeviceToken:(NSData *)token;
- (void)putDeviceToken:(NSData *)token withDeviceAlias:(NSString *)alias;
- (void)putDeviceToken:(NSData *)token withDeviceAlias:(NSString *)alias withDeviceTags:(NSArray *)tags;
- (void)deleteDeviceToken;

#pragma Push Notifications Method
- (NSString *)pushAlert:(NSString *)alert;
- (NSString *)pushAlert:(NSString *)alert sound:(NSString *)sound;
- (NSString *)pushAlert:(NSString *)alert sound:(NSString *)sound badge:(NSNumber *)badge;
- (NSString *)pushScheduledAlert:(NSString *)alert date:(NSDate *)date;
- (NSString *)pushScheduledAlert:(NSString *)alert sound:(NSString *)sound date:(NSDate *)date;
- (NSString *)pushScheduledAlert:(NSString *)alert sound:(NSString *)sound badge:(NSNumber *)badge date:(NSDate *)date;

- (NSString *)queueAlert:(NSString *)alert;
- (NSString *)queueAlert:(NSString *)alert sound:(NSString *)sound;
- (NSString *)queueAlert:(NSString *)alert sound:(NSString *)sound badge:(NSNumber *)badge;
- (NSString *)queueScheduledAlert:(NSString *)alert date:(NSDate *)date;
- (NSString *)queueScheduledAlert:(NSString *)alert sound:(NSString *)sound date:(NSDate *)date;
- (NSString *)queueScheduledAlert:(NSString *)alert sound:(NSString *)sound badge:(NSNumber *)badge date:(NSDate *)date;

- (NSString *)pushSuburbanAirshipNotification:(SuburbanAirshipNotification *)notif;

#pragma Delete Scheduled Push Notifications Methods
- (void)cancelAllNotifications;
- (void)cancelNotificationWithAlias:(NSString *)alias;
- (void)cancelNotificationsWithAliases:(NSArray *)aliases;

#pragma Process Pending Notifications Method
- (void)sendNotificationsInQueue;

#pragma mark Misc Methods
- (SuburbanAirshipNotification *)suburbanAirshipNotifForGUID:(NSString *)guid;
- (BOOL)isUrbanAirshipReachable;

I highly recommend checking out Urban Airship.  The staff has been extremely helpful and encouraging the entire time.  If you are doing a app with small volume of notifications, there really is no reason not to use them.  And if the app hits it big and you do go over there free limit, you should be making more than enough money to pay the small per notification fee (250,000 messages free per month, then just $0.0005/message).