Android 当应用程序位于前台时,flatter_local_通知会锁定系统托盘中的通知
这是我的密码。onLaunch和onResume工作正常,但当我使用flift\u local\u push通知显示来自FCM的通知时,当应用程序位于前台时,通知显示并工作正常,但在系统托盘中得到锁定,并且在刷卡时不会消失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(
@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);
}