Sending push notifications with Firebase Cloud Messaging (FCM)
push notifications are an extremely important feature for an app. They are messages sent to your app’s users that they can receive even when your app is not open. You can send notifications about anything: offers, updates, discounts, and any other type of message. This may help you keep users’ interest in your app. In this recipe, you will see how to leverage Firebase Messaging to send messages to your app’s users.
Getting ready
To follow along with this recipe, you need to complete the first two recipes in this chapter, Configuring a Firebase app and Creating a login form.
How to do it...
In this recipe, you will see how to send notification messages when your app is in the background. Please note that this code will not work on an iOS simulator (although it works perfectly on a physical device):
- Add the
firebase_messaging
plugin to your app. - At the top of the
main...