How to Add Cloud Messaging to Your Android App

How to Add Cloud Messaging to Your Android App

·

2 min read

Firebase Cloud Messaging

Firebase Cloud Messaging is a tool that helps you send notification messages or data messages to your client app whether it’s a single device, a group of devices, or devices subscribed to topics. The best part is that this service can be used at no cost.

Requirements

  • Android Studio
  • Google Account

How to add cloud messaging to your Android app

Step 1. Open your project in Android Studio, click on Tools → Firebase. Now, a list of Firebase tools will appear on the left, Scroll down and select Cloud Messaging, and then click on Set up Firebase Cloud Messaging.

1.png

Step 2. Connect your app to Firebase

2.png After clicking on Connect to Firebase, your browser will open. Then, select your google account.

Step 3. Create a new Project in Firebase

3.png

- Click on Create a project - Name your Project and click Next - Click on Create Project Now, it will take a few seconds to build your Project.

Once the project is built successfully, Connect Firebase with your Android Studio Project.

4.png

After connecting your project go back to Android Studio

Step 4. Add FCM to Your app

5.png Now, click on Accept Changes and build your Project.

Step 5. Run your App on AVD or any Physical Device

To send a notification to your app, go to Firebase console → Cloud Messaging → Input Your Notification content → select your app as Target → Schedule your notification → click Publish.