简体   繁体   中英

Firebase Push Notification not received when flutter app in foreground?

I am using firebase_messaging for firebase push notifications. 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

Check this package

Library for Local Notification

You can use flutter_local_notification to push notifications and you have to use this following code,

await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
    alert: true,
    badge: true,
    sound: true
  );

in the main method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM