简体   繁体   English

应用程序处于前台时未收到推送通知 ios flutter

[英]Push Notification not received when app is in foreground ios flutter

I have integrated firebase for push notifications in flutter.我已经集成了 firebase 用于在颤振中推送通知。 If the app is in foreground I have displayed a dialog with notification details.如果应用程序在前台,我会显示一个包含通知详细信息的对话框。 I am receiving notifications properly in android.我在 android 中正确接收通知。 Also in iOS notifications are working fine in background and when device is locked.同样在 iOS 中,通知在后台和设备锁定时都可以正常工作。 I have enabled push notifications and background fetch as well.我也启用了推送通知和后台获取。 Any solution for this?有什么解决办法吗? Has anybody faced such issue?有没有人遇到过这样的问题?

I am using this firebase plugin https://pub.dev/packages/firebase_messaging我正在使用这个 firebase 插件https://pub.dev/packages/firebase_messaging

  1. import UserNotifications in AppDelegate.在 AppDelegate 中导入 UserNotifications。

  2. UNUserNotificationCenter.current().delegate = self in didFinishLaunch UNUserNotificationCenter.current().delegate = self in didFinishLaunch

  3. Implement the below the method in AppDelegate.在 AppDelegate 中实现下面的方法。

func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping(UNNotificationPresentationOptions) -> Void) { print("Push notification received in foreground.") completionHandler([.alert, .sound, .badge]) }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 前台应用程序抖动时未收到 Firebase 推送通知? - Firebase Push Notification not received when flutter app in foreground? 应用程序在前台时收到的推送通知与应用程序在后台时收到的推送通知不同 - Push notification received while the app is in the foreground is different from push notification received when the app is in background 如果应用程序处于前台,则不会收到sendbird推送通知 - sendbird push notification not received if app is in foreground 如何使用IBM Mobilefirst接收到推送通知时知道应用程序是在后台还是在前台 - how to know if app is in background or foreground when push notification is received using IBM Mobilefirst 当应用程序处于前台时发送推送通知 - Push notification is sent when app is in foreground 收到推送通知时打开Android应用 - Open Android App when Push Notification is received 应用程序被终止时,设备未收到推送通知 - push notification not received to devices when app is killed 当应用程序不在后台或前台时,无法将通知推送到通知管理器 - When the app is not in background or foreground, not able push Notification to Notification manager 当我的应用程序前台服务被终止时,未收到 FCM 通知 - FCM Notification is not received when my app foreground service is killed 在Android中-当应用程序处于前台时如何防止Firebase推送通知? - In android - How to prevent Firebase push notification when app is in foreground?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM