Having the right engagement strategy within a mobile app has never been more important since users expect your app to provide them with useful and timely information.

With Notify, the new Twilio notifications API you can send your users real-time push notifications even when the app is not open.

Let’s build an Android app that can receive and react to push notifications sent from the server.

Our tools

Your favourite IDE for Android development. I will be using Android Studio.

Node.js installed.

A Twilio Account – Sign up for free!

Access to Notify – Request early access here

ngrok – You can read more about ngrok here.

Backend Configuration

To get our backend server going, we first need to create some credentials. Head to the Credentials section on the Notify Console and create a new push credential of type GCM. You will need a GCM API Key and a configuration file which you can generate by following the steps described in this page.

The Android Package Name must match your application’s package. If you have an existing application, you can copy this information from app/src/main/AndroidManifest.xml and in the manifest tag copy the value for package . If you’re creating an application from scratch, use the values as seen above.

When you’ve done that click Download google-services.json and copy the Server API Key . You will have to paste that key back where we were creating a push credential.

Make sure you save that and make a note of the SID of this push credential. You can find it back on the Credentials page.

Head to Services, click Create Service and name it anything you fancy. I’ve named mine Twilio Push . Under GCM Credential SID, choose the push credential you just created and hit Save.



Make a note of the SID for that too as we will need it when configuring our backend app. You can get that by going back to the Services page.

Our backend

Now that we have all the necessary credentials to send push notifications let’s do some work on our backend.