==

Q-Consultation for every industry

Securely hold virtual meetings and video conferences

Learn More>

Want to learn more about our products and services?

Speak to us now

How to Get your Android App Ready to add Push Notifications

Kirill Tolmachev
31 May 2022
Adding push notifications to your Android App

Push notifications are a useful communication tool, allowing your application to send automated messages to a user.

The QuickBlox communication platform fully supports this feature and in the following tutorial we explain with step-by-step instructions how to get your Android application ready to add this functionality.

Got more questions? Contact Support.

Tutorial:

First of all, you need to create a new project in the Firebase console and modify settings to your application and Quickblox Admin panel.

Open the Firebase admin console (URL: https://console.firebase.google.com).
Click Add project.

adding a project in Firebase

Enter the name of your project in the Project name field. In the same window, mark the checkboxes to use the default settings for sharing Google Analytics for Firebase data, and accept the related controller-controller terms. Click Create project to proceed.

creating a project in Firebase

On the project page, click the Settings icon next to Project Overview and select Project Settings.

project Settings in firebase

On the Settings page, select the Cloud Messaging tab.

Copy the string in the Token field and the Sender ID.

cloud messaging

Select the General tab containing the basic information of your project and click the Android icon to add a new Android app to your project.

Android project

Now you will need to configure the Android app data to connect it to Firebase.
In the Register app section, enter your package name and click Register app to register the application with Firebase.

register Android App

You can find the Android package name in your gradle app file in the applicationId field. Copy the package name and paste into the Android package name field.

Android Application ID

In the Download config file section, click Download google-services.json and, once the file downloading is complete, follow the instructions to store it in the root directory of your Android project.

download google services

Switch to Android Studio and open the Project section.

Android Studio Project

Move the google-services.json file you just downloaded to the root directory of the app package. Switch back to the FCM console and click Next.

json file in Android Studio

In the Add Firebase SDK section, copy the dependencies and add them to the gradle file. You will need to modify the build.gradle files both at the Project and App levels.

Add Firebase SDK

Switch to Android Studio and add the dependencies you copied to the build.gradle files for the Project and App.

Project build.gradle file:

App build.gradle file

App build.gradle file:

App build.gradle file

Switch back to the FCM console and click Next. The console will display the “Checking…” message showing that it checks whether your app has established communication with the server.

Important: In order to complete synchronization, the new app version has to be built/deployed to the device. A couple of attempts might be required. Please make sure that the old version is removed from the device.

Verifying installation of Android App

Once the synchronization has completed successfully, the console shows the confirmation message.

Successfully adding Firebase to your Android App

Login to your QuickBlox admin console (https://admin.quickblox.com) and select Push notifications.

Quickblox Admin Panel

In the top right corner, choose Settings.

QuickBlox Push Notification Settings

Expand the Google Cloud Messaging (GCM) API key section.
QuickBlox Google Cloud messaging

Insert the GCM API key for the Development and Production environment. Select Development and enter the Token value you copied from the FCM console. Click Save key.

Repeat the same steps for the Production environment. The new API keys will appear in the Environment: development and Environment: production sections.

Google Cloud Messaging API key

Mission accomplished! Your Android app is now ready for you to implement push notifications. Read the next tutorial, How to Implement Push Notifications in your Android App, to learn the final necessary steps.

Want to learn more about building Android Apps? Check out our other tutorials:

How to Launch Android Chat an Webrtc Video Conferencing Samples

How to Build an Android Chat Application with Kotlin using QuickBlox SDK

Have Questions? Need Support?

Join the QuickBlox Developer Discord Community, where you can share ideas, learn about our software, & get support.

Join QuickBlox Discord

Leave a Comment

Your email address will not be published. Required fields are marked *

Read More

Ready to get started?


Warning: Division by zero in /home/qb-wordpress/www/quickblox-website2/quickblox-website/wp-content/plugins/sassy-social-share/public/class-sassy-social-share-public.php on line 1371
QUICKBLOX
QuickBlox post-box