【发布时间】:2023-02-20 21:09:13
【问题描述】:
为什么我的 firebase 没有在前台/应用程序打开时显示通知,而是在 func.
我在 main() 里面的 main.dart 上有这个
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}');
}
FlutterAppBadger.updateBadgeCount(1);
});
在调试控制台上
D/FLTFireMsgReceiver( 4139): broadcast received for message
I/flutter ( 4139): Got a message whilst in the foreground!
I/flutter ( 4139): Message data: {}
I/flutter ( 4139): Message also contained a notification: Instance of 'RemoteNotification'
2
W/FirebaseMessaging( 4139): Unable to log event: analytics library is missing
【问题讨论】: