Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 当应用程序位于前台时,flatter_local_通知会锁定系统托盘中的通知_Android_Flutter_Firebase Cloud Messaging - Fatal编程技术网

Android 当应用程序位于前台时,flatter_local_通知会锁定系统托盘中的通知

Android 当应用程序位于前台时,flatter_local_通知会锁定系统托盘中的通知,android,flutter,firebase-cloud-messaging,Android,Flutter,Firebase Cloud Messaging,这是我的密码。onLaunch和onResume工作正常,但当我使用flift\u local\u push通知显示来自FCM的通知时,当应用程序位于前台时,通知显示并工作正常,但在系统托盘中得到锁定,并且在刷卡时不会消失 @override void initState() { super.initState(); debugPrint('homebar ka init chal raha hai'); _fm = FirebaseMessaging(

这是我的密码。onLaunch和onResume工作正常,但当我使用flift\u local\u push通知显示来自FCM的通知时,当应用程序位于前台时,通知显示并工作正常,但在系统托盘中得到锁定,并且在刷卡时不会消失

    @override
    void initState() {
    super.initState();
    debugPrint('homebar ka init chal raha hai');
    _fm  = FirebaseMessaging();

    _fm.configure(
    onMessage: (Map<String, dynamic> message) async {
    print("onMessage: $message");
        var json = message['notification'];
        showNotification(json['title'],json['body']);
     
      },
        onBackgroundMessage: myBackgroundMessageHandler,
     
       onLaunch: (Map<String, dynamic> message) async {
           print("onLaunch: $message");
           requestRecieved();
          
      
      },
      onResume: (Map<String, dynamic> message) async {
          print("onResume: $message");
          requestRecieved();

         
         }
      );
   


    // debugPrint('show notification method is working');
    flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
    var androidInitializer = AndroidInitializationSettings('@mipmap/ic_launcher');
    var iosInitializer = IOSInitializationSettings();
    var generalInitializer = InitializationSettings(androidInitializer, iosInitializer);
    flutterLocalNotificationsPlugin.initialize(generalInitializer,onSelectNotification: (value)
    {
        // setPage.setPageValue(2);
    }
    );


    super.initState();
    }
     showNotification(String title,String body)
                 
                 {
                   debugPrint('shownotification chal raha hai');
                  
                   var androidSettings = AndroidNotificationDetails('fcm_default_channel',                                                                                'channelName', 'channelDescription',
                   importance: Importance.Max,
                     priority: Priority.Max,
                     ongoing: true,
                     autoCancel: true
                     
                   );
                   var iosSettings = IOSNotificationDetails();
                   var platform   = NotificationDetails(androidSettings, iosSettings);
                  newNo tify.setNotificationValue(true);
                  flutterLocalNotificationsPlugin.show(0, title,body, platform);
                 }