So I have a question, because I am not fully understand something. So I wrote a simple app, to try something, so I send a message from Firebase via Firebase Cloud Messaging. I use the firebase_messaging flutter plugin (7.0.3 version). It just does a simple thing to get the message and navigate to another page. My problem is the following one, the onMessage and the onResume function works perfectly, but when the app is terminated and I click on the notification the app opens but nothing happens. So I read the documentation and I found this
The third row says, that the data is lost... Does this mean that I lost every data in the payload?
My code is here if it helps
static final NavigationService _navigationService =
loc.Locator.locator<NavigationService>();
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
Future<void> reqPermission() async {
bool permission = true;
if (Platform.isIOS) {
permission = await _firebaseMessaging.requestNotificationPermissions();
}
if (permission) {
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print(message);
await _navigationService.navigateTo(NewPage.routeName);
},
onLaunch: (Map<String, dynamic> message) async {
print('onLaunch $message');
await _navigationService.navigateTo(NewPage.routeName);
},
onResume: (Map<String, dynamic> message) async {
print('onResume $message');
await _navigationService.navigateTo(NewPage.routeName);
},
onBackgroundMessage: _myBackgroundHandler,
);
}
}