How to set up custom push notifications via Firebase for Android

By default, push notifications are sent to Virola Client apps on mobile devices by the Virola Server on events such as new messages or calls. Virola Server uses APNS and Google GCM (FCM) services to send push notifications.

Starting with version 2.8.1.26052216, you can set up custom push notifications for Android on the Virola Server. Custom push notifications will allow you to completely decouple from our push notification infrastructure and eliminate any dependency on it. Using Google Firebase, you can connect the Virola Android app and receive push notifications through your server. All you need is an active Google account and the same versions of the Virola Server, Virola Client, and the Virola Android app.

Please note! This instruction is for Android only. iOS push notifications will continue to work as before.

Set up Firebase

You need to create a Firebase project to connect it to the Virola Android app.

1. Create a Firebase project

Follow Step 1"View instructions to create a Firebase project" on this page.

2. Register Virola Android app with Firebase project and add a Firebase configuration file

  1. Open your created Firebase project
  2. Click the "+ Add app""Android" icon
  3. Enter io.virola.virola_client in the Android package name field
  4. Make sure to enter the package name io.virola.virola_client without any changes. The package name is case-sensitive and cannot be changed for this Firebase Android app after it's registered with your Firebase project.

    Screenshot of Firebase Project settings
  5. Click the "Register app" button
  6. Download the Firebase configuration file containing the data to be added to your Virola Client. Click the "Download google-services.json" button.
  7. Close the window with the top left "X".

3. Generate the private key

  1. Click the package name button below your project name, then Settings "gear" icon
  2. Screenshot of Firebase Project settings
  3. Open the "Cloud Messaging" tab
  4. In the Firebase Cloud Messaging API section, click on the link "Manage Service Accounts"
  5. Click the three-dot icon in the "Actions" column → "Manage keys"
  6. Screenshot of Firebase Project settings
  7. Then click "Add keys" → "Create new key"
  8. Choose JSON as the key type → "Create"
  9. Save the project_name_key.json file with the current private key securely

After the private key is created, you may need to refresh the page to see it. Make sure that the key has "Active" status in the Status column.

Set up Virola Server

To connect your Firebase project with the Virola Server, log in to Virola Client as the server administrator and do the following:

  1. Go to "Administration" → "Push Notifications"
  2. Open the "Advanced" tab, check the box "Use Custom Push Options for Android", and complete the form
  3. Open the google-services.json file that was downloaded during the Firebase project registration.
  4. You will find the following data in this file:

    • project_id
    • client.client_info.mobilesdk_app_id
    • client.api_key.current_key

    Copy the data between the quotation marks and paste it into the corresponding field.

  5. Open the project_name_key.json file that you saved during the private key generation
  6. You will find the following data in this file:

    • private_key_id
    • private_key
    • client_email
    • token_uri

    Copy the data between the quotation marks and paste it into the corresponding field

  7. Then click "Apply". You will see the "Saved on Server" message.

For custom push notifications to work, users on your server will need to reconnect their Virola Android apps.