James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Live, Love, Bike, and Code

Share


Tags


Push Notification Options for Mobile Apps

My good friend Andrew and I recently had a Twitter conversation on what is the best route to take when implementing push notifications in your mobile applications. If you do a quick search there are a lot of options out there and it can be tricky to figure out the best route to take, but having implemented push notifications in several applications I can tell you there are really only two options you need to consider.

How Push Notifications Work

The reason push notifications are complicated is because each operating system uses a different service that the app or server needs to talk to.

Each have a different SDK that needs to be implemented into your application and if you want complete control you may have a server setup that is used to communicate to all three at the same time like this:

pns

The Options

Implementing all of this yourself would be pretty much terrible as you would need to worry about device registration, device refresh, talking to each service, and then integrating a different SDK into each application. Don't do that, we are cross-platform developers and for Xamarin developers (and for non-Xamarin developers) we have amazing solutions with Visual Studio App Center and Azure Notification Hubs. Each offer a simplified cross-platform solution that get rid of all the pain points for you. Each have some pros and cons. so let's take a look!

Visual Studio App Center

By far the easiest solution for implementing push notifications in your mobile applications. App Center has a single cross-platform SDK that can be implemented in just a few lines of code.

microsoft-visual-studio-app-center

Pros:

You can send push notifications easily in the browser:

PushNotification

Or use their full API to send them from your own server:
push-swagger

There is an extremely small amount of code to put into your mobile applications and the SDK handles just about everything for you. I was surprised when I got push notifications working in under 30 minutes between iOS and Android.

Their documentation is fantastic and you do get control over what happens when the user taps on a notification. There aren't very many cons that I can think of:

Cons:

All in all I would say App Center is the go to for 80-90% of all applications on the market that need to do push notifications.

Azure Notification Hubs

If you want full control over your notifications and don't mind doing a little bit more work inside of your applications to set it up then Azure Notification Hubs is for you. Notification Hub sits in the middle of your server and devices to handle registration and offer a single source.

notification-hub

Pros:

The big different between App Center and Notification Hubs is that you are implementing the code inside of iOS/Android/Windows to handle the push notification device registration and the actual notification that appears. This means that you have to write your own background service on Android and handle the different states on iOS. This means you can do whatever you want in the notifications that are displayed including grouping, in-line replies, etc.

Cons:

All in all Notification Hub is a great option (this is what I used for the Evolve App, although I would have used App Center if it was available at the time) if you want full control over your notification backend and appearance inside of your application. If you are building an application that handles emails, Sms, and other complex notifications then this is your option.

Summary

Notifications look complex, but with App Center and Notification Hubs they are crazy simple to implement (as long as you figure out Apple's certs!).

In short for probably 90% of apps out there that need notifications, App Center is perfect for you (especially with their API)! If you are building something like an sms or email app and need that crazy deep custom control over everything (on Android mostly) then Notification Hubs is for you.

Go off read some docs and have fun with push notifications.

Copyright © James Montemagno 2018 All rights reserved. Privacy Policy

View Comments