• Choose:

Push Notifications

Most people will be familiar with push notifications- they’re the clickable pop-up messages across mobile applications. Push Notifications allow users to read messages from apps, without having to actually open the application.

These tutorials will guide you through how to implement push notifications in your WebRTC applications for iOS and Android devices. If you have any questions, click the chat box in the lower right hand corner for help from our support team.## Android Push Notification Setup

The Telnyx Android Client WebRTC SDK makes use of Firebase Cloud Messaging in order to deliver push notifications. If you would like to receive notifications when receiving calls on your Android mobile device you will have to enable Firebase Cloud Messaging within your application.

In order to do this you need to:

  • Set up a Firebase console account
  • Create a Firebase project
  • Add Firebase to your Android Application
  • Setup a Push Credential within the Telnyx Portal
  • Generate a Firebase Cloud Messaging instance token
  • Send the token with your login message

Adding Firebase to your application is a simple process. Click on the Android icon on the home screen of the console to start: firebase-pn-screen

Next, enter your application details and register your application add-firebase-to-app

After your application is registered, Firebase will generate a google-services.json file for you which will need to be added to your project root directory: download-config-file-firebase

After that, you can follow this guide on how to enable the firebase products within your application https://firebase.google.com/docs/android/setup#add-config-file

An alternative method is to add Firebase using the Firebase Assistant within Android Studio if it is setup within your IDE. You can view steps on how to register via this option here: https://firebase.google.com/docs/android/setup#assistant

Once your application is set up within the Firebase Console, you will be able to access the server key required for portal setup. You can access the server key by going into your project overview -> project settings and selecting Cloud Messaging. Once there, the project credentials will be visible for use in our portal setup. add-server-key

The next step is to set up your Android VoIP credentials in the portal.

  1. Go to portal.telnyx.com and login.
  2. Go to the API Keys section on the left panel.
  3. From the top bar go to the Credentials tab and select “Add” >> Android Credential


  1. Enter the details required for your Android Push Credentials. This includes a Credential name and the server key from firebase mentioned in an earlier step.


Save the new push credential by pressing the Add Push Credential button

We can now attach this Android Push Credential to a SIP Connection:

  1. Go to the SIP Connections section on the left panel.
  2. Open the Settings menu of the SIP connection that you want to add a Push Credential to or create a new SIP Connection.
  3. Select the WebRTC tab.
  4. Go to the Android Section and select the PN credential you previously created.


The portal setup is complete. Now when firebase is properly integrated within your application, you will be able to retrieve a token with a method such as this:

private fun getFCMToken() {
   FirebaseMessaging.getInstance().token.addOnCompleteListener { task ->
       if (!task.isSuccessful) {
           Timber.d("Fetching FCM registration token failed")
       else if (task.isSuccessful){
           // Get new FCM registration token
           try {
               token = task.result
           } catch (e: IOException) {
           Timber.d("FCM token received: $token")

This token can then be used with the Login Message to register yourself for Push notifications. You can read more about login Messages here https://developers.telnyx.com/docs/api/v2/webrtc#android-client-sdk

The final step is to create a MessagingService for your application. The MessagingService is the class that handles FCM messages and creates notifications for the device from these messages. You can read about the firebase messaging service class here: https://firebase.google.com/docs/reference/android/com/google/firebase/messaging/FirebaseMessagingService

We have a sample implementation for you to take a look at here: https://github.com/team-telnyx/telnyx-webrtc-android/blob/main/app/src/main/java/com/telnyx/webrtc/sdk/utility/MyFirebaseMessagingService.kt

Once this class is created, remember to update your manifest and specify the newly created service like so:


You are now ready to receive push notifications via Firebase Messaging Service.

Was this page helpful?