I use ASP .NET RestAPI as my Flutter App's backend and want to send notification to my app when some event occurs. What is the best way to implement this?
I use ASP .NET RestAPI as my Flutter App's backend and want to send notification to my app when some event occurs. What is the best way to implement this?
I suggest you using Firebase Cloud Messaging.
Flutter has first party plugin firebase_messaging for that.
It's easy to integrate Firebase SDK to your flutter application.
Once setup the Firebase SDK to your flutter application you can use FCM rest API to send push notification to your application.
Remember to prepare a backend API to save your clients (devices) FCM token, because you need a device token to send a push notification to a specific device.
You can send FCM notification using your server or from client side from flutter app. Use the Rest API for the FCM and send the notification easily.
Checkout this post: https://arkapp.medium.com/flutter-fcm-rest-api-7719925f2e3e
Post API URL:
https://fcm.googleapis.com/fcm/send
Request Body:
{
"to": "<FCM Token>",
"priority": "high",
"notification": {
"title": "Hyree FCM testing",
"body": "Testing the fcm notification for different fcm token",
"sound": "default"
}
}