Gov*_*iyo 5 dart firebase flutter firebase-cloud-messaging
我正在使用firebase_messaging 当通知出现时,我正在显示警报对话框。下面是我的代码。
showNotification(BuildContext context) {
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print('on message $message');
_showPushNotificationDialog(message['notification']['title'],
message['notification']['body'], context);
},
onResume: (Map<String, dynamic> message) async {
print('on resume $message');
_showPushNotificationDialog(
message['data']['title'], message['data']['body'], context);
},
onLaunch: (Map<String, dynamic> message) async {
print('on launch $message');
_showPushNotificationDialog(
message['data']['title'], message['data']['body'], context);
},
);
}
Run Code Online (Sandbox Code Playgroud)
_showPushNotificationDialog每次调用onMessage、onResume和onLaunch方法时,都会调用Where方法。
面临诸如当我的应用程序处于后台或终止模式时会出现通知并将点击通知托盘的问题,一切都很好。但是,当我转到其他页面并返回上一个所有时间_firebaseMessaging.configure(....方法调用时,它有数据,所以每次我的警报对话框都会出现。
那么如何清除通知托盘点击的通知呢?
| 归档时间: |
|
| 查看次数: |
2993 次 |
| 最近记录: |