Am getting a frustrating experience with firebase messaging on my flutter app as onBackgroundmessage is not getting triggered while app is in background after sending request. I would like to know why as this is a core feature my app needs.
Future initialize(context) async{
_firebaseMessaging.configure(
onBackgroundMessage: Platform.isIOS ? null:_myBackgroundMessageHandler,
);
}
Future<dynamic> _myBackgroundMessageHandler
(Map<String, dynamic> message) async {
print("onBackground Message called");
fetchRideInfoInBackground();
return Future<void>.value();
}
}
Notification Payload
const message = {
notification: {
title: 'New Incoming Request',
body: `New incoming ${service} request`,
},
data: { orderId: orderId },
android: {
ttl: 30,
priority: 'high',
notification: {
click_action: 'FLUTTER_NOTIFICATION_CLICK',
},
},
tokens: driversRegistrationToken,
};