How to set up custom Push notifications via Firebase Project for Android
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 a custom Push notifications option for Android on the Virola server. Using the Google Firebase, you can connect the Virola Android app and get 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.
Make a set up on the Firebase side
You need to create a Firebase project to connect to the Virola Android app with Firebase.
1. Create a Firebase project
Follow the 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
- Open your created Firebase project
- Click on the "+ Add app" → "Android" icon
- Add the io.virola.virola_client in the Android package name field
- Click on "Register app" button
- Download a Firebase configuration file containing the data to be added to your Virola Client. Click on "Download google-services.json" button.
- Close the window with "x" on the top left
Make sure to enter the package name io.virola.virola_client without any changes. The package name value is case-sensitive, and it cannot be changed for this Firebase Android app after it's registered with your Firebase project.
3. Generate the private key
- Click on the project name then Settings "gear" icon
- Follow Cloud Messaging tab
- In the Firebase Cloud Messaging API section click on the link "Manage Service Accounts"
- Click on the "three-dots" icon in Actions column → "Manage keys"
- After that click on "Add keys" button → "Create new key"
- Choose the Key type JSON → "Create"
- Save the project_name_key.json file with the current private key securely
After the private key is created, check if the key has "Active" status in the Status column.
Make a set up on the Virola client side
To connect your Firebase project with Virola server you need to log into Virola client as the server administrator and do the following:
- Follow Administration → Push Notifications menu
- Choose the Advanced tab, check the box Use Custom Push Options for Android and complete the form
- Open the google-services.json file that was downloaded during the Firebase project registration.
- project_id
- client.client_info.mobilesdk_app_id
- client.api_key.current_key
- Open the project_name_key.json file that you saved during the private key generation
- private_key_id
- private_key
- client_email
- token_uri
- Then click "Apply". You'll get the "Saved on Server" message
You will find the following data in this file:
Copy the data between quotes and paste in the specific field.
You will find the following data in this file:
Copy the data between quotes and paste in the specific field.