I have tried to use Firebase Cloud Messaging.
It makes a sound, but I also want to show a heads-up notification.
Like this.
Firebase Cloud Messaging (FCM) provides a reliable and battery-efficient connection between your server and devices that allows you to deliver and receive messages and notifications on iOS, Android, and the web at no cost.
To receive messages, use a service that extends FirebaseMessagingService. Your service should override the onMessageReceived and onDeletedMessages callbacks. It should handle any message within 20 seconds of receipt (10 seconds on Android Marshmallow).
Using Firebase Cloud Messaging, we can send three types of messages, i.e., Notification Message, Data Message, and the message with both Notification & Data Payload.
The notification only pops up when your app is running in the background or terminated from the recent menu. If the app is open, there won't be any heads-up notification. Follow this link to learn more about how Android and iOS will handle notification or data based on the state of the app.
Hopefully, this helped you. Let me know if you still need help with the code or setting up the FCM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With