[英]Firebase Push Notification not received when flutter app in foreground?
I am using firebase_messaging for firebase push notifications.我正在使用firebase_messaging进行 firebase 推送通知。 I received push notifications when app in background or app is forcefully closed but not received when app in foreground.
我在后台应用程序或应用程序被强制关闭时收到推送通知,但在前台应用程序时未收到。
And Second issue is push notification show without app icon.第二个问题是没有应用程序图标的推送通知显示。 Its shows blank square icon.
它显示空白方形图标。
firebase doesn't show push notifications when the app in foreground, So we need to configure the local notification for Firebase当应用程序在前台时,firebase 不显示推送通知,因此我们需要为 Firebase 配置本地通知
Check this package检查这个包
You can use flutter_local_notification to push notifications and you have to use this following code,您可以使用flutter_local_notification来推送通知,您必须使用以下代码,
await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
alert: true,
badge: true,
sound: true
);
in the main method.在主方法中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.