Correctly using push and local notifications

Tutorial By 4 years ago

I have built a lot of apps that do notifications. On iOS there are two types of notifications that will show a message to the user – local notifications and push notifications.

Local notifications

Local notifications are all handled all by your device. The device schedules known notifications all in advance, and they trigger at a specified fire date. Because everything is local, an internet connection is not required to receive these notifications.

Push notifications

Push notifications are all scheduled via a remote server and sent to your device when they need to be shown. This means that the device doesn’t need to know about what will happen in the future, because all alerts are sent as they are needed. Becuase a server is required, if a device is offline when a notification is sent, it will instead show when the device is next online.

Unfortunately some of our clients try to pick which solution to use based on the cost of implementation, choosing the wrong type of notification for the scenario, instead of letting the professional developers that do this day in and day out tell them which solution is most appropriate.

It is true that push notifications will require more effort than local because they need a server that pushes out notifications to potentially thousands of devices all in a short period of time. However if you don’t care about event based notifications (such as Facebook’s “Joe Bloggs has liked your post” notifications) then the cost can be minimised greatly by using a 3rd party service, and could be nearly the exact same cost to implement.

Examples of correct use

Future promotions
Push notifications are the correct solution here. Some clients have tried to save a dollar or two by suggesting local notifications for a potential promotion in 6 months time. I’ve been around the block and I know that in 6 months time that might not be the case, so the freedom of push notifications greatly outweighs having to release a useless update to turn off something you’ve changed your mind about because it was hardcoded into the app.

An alarm is a date and time set by the user. A server doesn’t need to be involved in popping up this type of message. Local notifications are the perfect solution for this scenario.

Assuming the news is spontaneous then it should be pushed to the phone when it becomes available.

Rare exceptions
b2cloud builds the official Telstra Sydney New Years Eve app. The NYE event has hundreds of thousands of people all in one small area. Cell towers become overwhelmed and often people can’t get network coverage. Because of this, pretty much all notifications in this app are local.