Best android open-source packages and libraries.

FCMSpecificNotifications

☁️ Send push notifications to a specific user using Firebase Cloud Messaging (FCM)
Updated 2 years ago

FCM Specific Notifications

GitHub release MIT License

This Android app demonstrates how you can send notifications from one user to another using Firebase Cloud Messaging (FCM). To send a notification, we need a user token as a recipient, which is stored in the database using the Firebase Realtime Database.

The user authentication is handled with a one-step Google Sign-In powered by Firebase Authentication.

How it works

How user tokens are stored

  1. Each APK will generate one token.
  2. When the user is authenticated, the token will be stored in the database by user ID.
  3. Tokens are subject to change under certain conditions. So, we can add a mechanism to store tokens in the database periodically, for example, every time the application is opened.

How the notifications are sent

  1. Notifications are sent with a recipient token.
  2. To get the recipient token, we just need to enter the user ID and the app will fetch the token by the user ID from the database.

Download

Check out the release page and download the latest apk.

Tech-stack

Configuration

Firstly, clone this repository and import it into Android Studio (git clone https://github.com/ariefzuhri/FCMSpecificNotifications.git).

Setup Firebase Project

  1. Open the Firebase Console and click Add project (or use an existing Firebase sandbox project).
  2. Follow the instructions there to create a new Firebase project.
  3. Go to Project Settings and at the bottom, click on the Android icon to register your Android app.
  4. Follow the instructions there again and make sure the package name matches your app ID in the Android Studio project. It is also required to include a debug signing certificate SHA-1 to support Google Sign-In in Firebase Authentication.
  5. Download the google-services.json file and move it into Android app module root directory (./app).

Setup Firebase Authentication

  1. Go to Authentication and click the Get started button to enable it.
  2. Enable Google in the Sign-in method section.

Setup Firebase Realtime Database

  1. Go to Realtime Database and click the Create database button to enable it.
  2. Select Start in test mode as the Security rules

🤝 Support

Any contributions, issues, and feature requests are welcome.

Give a ⭐️ if you like this project.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

This idea is inspired by KOD Dev.

Tags fcm