How keep my AndroidNotificationDetails when the app is in background/app closed ?
Here the code of FirebaseMessaging.onMessage :
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
RemoteNotification? notification = message.notification;
AndroidNotification? android = message.notification?.android;
flutterLocalNotificationsPlugin.show(
notification.hashCode,
notification.title,
notification.body,
NotificationDetails(
android: AndroidNotificationDetails(
channel.id,
channel.name,
channelDescription: channel.description,
color: ControllerColors.getPrimaryColor(), // Color orange
icon: "@mipmap/ic_launcher"
)
)
);
});
Here the code when I handle the background :
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage remoteMessage) async
{
await Firebase.initializeApp();
await setupFlutterNotification();
FirebaseMessaging fcm = FirebaseMessaging.instance;
await fcm.getToken();
}
All works very good but my app_name color (orange) in AndroidNotificationDetails is not orange when the app is in background.
How resolve it ?