Notifications inside native app recreate entire app
Within a native app in Kotlin/Java, the flutter code is started after the login page. That code receives message from firebase which in turn create notification with the simple below code:
sl<FlutterLocalNotificationsPlugin>().show(id, title, body, platformChannelSpecifics, payload: payload);
Platform specifics on Android are as follows:
AndroidNotificationDetails androidPlatformChannelSpecifics = const AndroidNotificationDetails(
"COMPANY",
"Company notifications",
channelDescription: "Notifications for new messages",
importance: Importance.defaultImportance,
priority: Priority.defaultPriority,
icon: "app_icon",
channelAction: AndroidNotificationChannelAction.update,
);
When tapping those notifications the app is re-created from scratch back to login page instead of being brought to front. Flutter code doesn't get the payload ever. Even if the app is the top visible app and being used by user, tapping the notification recreates it!
What can I do to avoid that ?
EDIT: Tapping the notification launches the only activity flagged with "LAUNCHER", hence back to login page. OS acts as if app is in background and reports this: Activity start ONLY allowed by BAL_ALLOW_NON_APP_VISIBLE_WINDOW
Where/how can I specify the notification intent to use ?
There isn't the ability to specify the intent to use. Unless you know of another solution that can submit a PR that works for you and existing users of the plugin, you may have to consider a fork or custom implementation. The reason why plugin needs to look for the activity with the launcher intent to handle the scenario where an app is terminated that tapping on the notification launches the app. This would be a scenario for your own app to consider as well so is something to factor in if you haven't done so already