Skip to main content
When you finish this page, pgw can wake your Android app for a call. Android wakes a closed app through Firebase Cloud Messaging (FCM), Google’s push service. FCM is free. It delivers a message to an app only when the message comes from the Firebase project that the app was built for. So you create a Firebase project, build its configuration into the app, and give pgw a key to the same project.

Before you begin

  • A Google account for the Firebase console.
  • The app’s package name, such as com.example.phone.

Create the Firebase project and its key

1

Create the Firebase project

In the Firebase console, create a project, and add an Android app with your package name.
2

Download the app configuration

Download google-services.json for the app build.
3

Note the project ID and number

In Project settings, on the General tab, note the project ID and the project number.
4

Create a service account key

On the Service accounts tab, choose Generate new private key, and save the JSON file.
The service account key is a credential. Don’t commit it or share it.

Register the Android app in pgw

Give pgw the project’s ID, its number, and the key:
Set the project number too, even though pgw doesn’t require it. When an Android app registers, it names its Firebase project, and pgw uses that name to find the app record. Some apps send the ID and others send the number, so with both set, either one matches. Each Android app needs its own Firebase project. pgw refuses a second Android app with the same project.

Check that it works

Register the app through pgw, swipe it away, and call the account. The phone rings.

If it doesn’t work

Which push pgw sends for each event

pgw sends every push as an FCM data message, which means that the app receives the data and decides what to show. pgw sends call and missed-call pushes with high priority, so that Android wakes the app at once. It sends refresh and test pushes with normal priority. The app must show a notification for every high-priority message, because Android lowers the priority of an app that doesn’t. For the fields of each push, see Push payload.

Next steps

Integrate your app

Send the push token in the REGISTER and show a notification for each call.

Try it on the Android emulator

Test the Firebase setup with an open-source app before you change your own.