I am doing fcm integration to flutter demo application.onMessage method is not called when data only message is sent through postman in any condition(forground,background,killed.) (ios physical device iphone5s).
I have tried notification +data message it is working properly. as described in firebase_messaging plugin.
{
"to" :"firebase-token",
"data" : {
"click_action": "FLUTTER_NOTIFICATION_CLICK",
"body" : {
"message":"this is data message"
},
"title" : "data title",
"content_available" : true,
"priority" : "high"
}
}
here is content of notification request of postman
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
Fimber.d("onMessage: $message");
Fluttertoast.showToast(msg: "onMessage: $message",
toastLength: Toast.LENGTH_LONG
);
},
onLaunch: (Map<String, dynamic> message) async {
Fimber.d("onLaunch: $message");
Fluttertoast.showToast(msg: "onLaunch: $message",
toastLength: Toast.LENGTH_LONG
);
},
onResume: (Map<String, dynamic> message) async {
Fimber.d("onResume: $message");
Fluttertoast.showToast(msg: "onResume: $message",
toastLength: Toast.LENGTH_LONG
);
},
);
_firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(sound: true, badge: true, alert: true));
_firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings settings) {
Fimber.d("Settings registered: $settings");
});
_firebaseMessaging.getToken().then((String token) {
Fimber.d("token: $token");
});
it is in init state of homepage.
i have permission notifications in ios and working well with notification+data.
-result should be as described in https://pub.dartlang.org/packages/firebase_messaging#-readme-tab-