The Internet is Amazing!
The GeoNet Project provides a range of ways that you can stay up to date with geohazards information for New Zealand. This includes smart phone applications that provide near real time earthquake push notifications for both Android and iOS devices. I’ve worked with the internet for a long time but some days it still amazes me - receiving an earthquake notification on a phone in my pocket within moments of an earthquake occurring is one of those times. It’s both disarmingly simple and complex at the same time. Here’s how we get the earthquake location to the phone in your hand.
Getting push notifications to your phone involves services in several countries. The numbered steps are described below.
1. The Application on Your Phone
To receive near real time push notifications you have to have the GeoNet app for Android or iOS installed on your phone, it has to be connected to the internet, and you have to have your quake preferences set appropriately.
2. Pushing to the Phone
We don’t connect to your phone directly to send the push notifications, Apple or Google do this for us via either the Apple Push Notification Service or Google Cloud Messaging. When it’s on the internet (and you’ve given it permission) your phone maintains a connection to the Apple or Google servers and receives push notification messages over that connection. When your phone isn’t connected those servers store messages to send to your phone next time it connects to the internet. Using these services also allow the application on the phone to receive messages even when it’s in the background.
We use Urban Airship to send push notifications to the Apple and Google messaging services. Urban Airship give us a single API to send messages to and do all the hard work of maintaining the connection to the Apple and Google service as well as staying up to date with any changes to those services. Urban Airship also provide some handy reporting tools for us.
3. Managing Your Preferences
We run a back end application to store your quake notification preferences. When a quake message is received the preferences are used to decide which phones should be notified about this quake and a push message is sent to Urban Airship. We run the back end application in AWS Elastic Beanstalk in the Sydney region. This gives us very easy deployment, high availability, and easy scaling as demand increases (like it did after the recent earthquakes).
4. Locating the Quake
This is done by GeoNet Rapid, automatically in near real time and reviewed by the duty officer as required. It’s using all that great data coming from the remote seismic sensor network.
The Internet is Amazing!
When the notification arrives on my phone it has started from a message about an earthquake location in New Zealand, been sent to Sydney, forwarded onto America, and sent back to my phone in New Zealand. This all happens within moments of the earthquake occurring. A journey of over 25,000 km passing through several cloud services. This might not be magic but every time it happens it seems pretty close to it to me.