Код: Выделить всё
D/FLTFireMsgReceiver(26011): broadcast received for message
I/flutter (26011): Got a message whilst in the foreground!
I/flutter (26011): Message data: {}
I/flutter (26011): Message also contained a notification: Instance of 'RemoteNotification'
Код: Выделить всё
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
FirebaseMessaging messaging = FirebaseMessaging.instance;
NotificationSettings settings = await messaging.requestPermission(
alert: true,
announcement: false,
badge: true,
carPlay: false,
criticalAlert: false,
provisional: false,
sound: true,
);
print('User granted permission: ${settings.authorizationStatus}');
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
print('Got a message whilst in the foreground!');
print('Message data: ${message.data}');
if (message.notification != null) {
print('Message also contained a notification: ${message.notification}');
}
});
// FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
runApp(MyApp());
}
[1]:

[Уведомление не отображается , симулятор][1]
Подробнее здесь: https://stackoverflow.com/questions/738 ... d-for-mess
Мобильная версия