简体   繁体   English

当我尝试以终止状态(当应用程序终止时)发送通知时,我的颤振 IOS 应用程序出现问题

[英]I have an issue in my flutter IOS app when i try to send notification in kill state(when App Terminated) notification is not coming

I am developing a flutter app which have push notification property , everything is working fine when app is on foreground or background notification coming continuously , but when app is on terminated state means when app not on background then notification is not coming why ?我正在开发一个具有推送通知属性的颤振应用程序,当应用程序处于前台或后台通知连续发出时一切正常,但是当应用程序处于终止状态时意味着当应用程序不在后台时,通知不会出现,为什么?

and in android notification working properly in all states (Foreground ,Background,Kill State when app terminated)并且在 android 通知中在所有状态下都能正常工作(前台、后台、应用程序终止时的终止状态)

This is my Payload for sending notification in IOS这是我在 IOS 中发送通知的有效负载

{"to":"Device-token","content_available":true,"data":{"title":"Message","body":"Lorem Ipsum is simply dummy text of the printing and typesetting industry.","date":"Tue, 12 Jul 2022","time":"11:53","click_action":"FLUTTER_NOTIFICATION_CLICK","show_title":"Test Notification Title.","id":123,"checkdate":"2022-07-12","image":"https://crm.satoshifx.com/assets/images/satoshifx-notification.jpg"}}{"multicast_id":2817247928782996095,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"1657619612508875"}]} {"to":"Device-token","content_available":true,"data":{"title":"Message","body":"Lorem Ipsum 只是印刷和排版行业的虚拟文本。", "date":"Tue, 12 Jul 2022","time":"11:53","click_action":"FLUTTER_NOTIFICATION_CLICK","show_title":"测试通知标题。","id":123,"checkdate" :"2022-07-12","image":"https://crm.satoshifx.com/assets/images/satoshifx-notification.jpg"}}{"multicast_id":2817247928782996095,"success":1,"失败":0,"canonical_ids":0,"results":[{"message_id":"1657619612508875"}]}

You can test this on release mode;您可以在发布模式下进行测试;

In your main在你的主要

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
  await flutterLocalNotificationsPlugin
      .resolvePlatformSpecificImplementation<
          AndroidFlutterLocalNotificationsPlugin>()
      ?.createNotificationChannel(channel);

  await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
    alert: true,
    badge: true,
    sound: true,
  );
  runApp(const RestartWidget(child: const MyApp()));
}

///Define this outside your main 

Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  await Firebase.initializeApp();
} 

暂无
暂无

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

相关问题 flutter 通知不会出现在 ios 当应用程序正在杀死 state 但当我们打开应用程序时通知即将到来 - flutter notification is not coming in ios when app is on kill state but when we open the app notification is coming 当应用程序在 iOS 14 中终止或终止时,未收到 Voip 通知 - Voip notification did not receive when app kill or terminated in iOS 14 当我收到静默推送通知时,iOS 会唤醒我的应用程序吗?(当应用程序未处于运行状态时) - Will iOS awake my app when i receive silent push notification?(When app is not in running state) 应用程序终止时的 Swift IOS 启动通知 - Swift IOS launch notification when app terminated 当应用程序在后台或终止时,推送通知未进入 IOS 设备。 在 Flutter 的 IOS 设备中导航到下一个屏幕也不起作用? - Push notification not coming in IOS device when app in background or kill. Navigate to next screen also not working In IOS device in Flutter? 当我的应用程序被终止时不会收到通知 - dont get notification when my app is kill 应用程序终止时推送通知 - Push notification when app is terminated 应用终止时的远程通知 - Remote notification when app is terminated 当应用程序处于状态背景或被杀死时,如何在不点击通知的情况下存储 iOS 远程通知? - How can i store iOS remote notification when app in state background or killed, and without tap the notification? 我杀死应用程序后未收到Firebase推送通知? - Firebase Push notification is not Received when i kill the app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM