我使用Flutter_isolate包在后台处理本地通知。 一切都很好,将显示通知弹出窗口。但是,当我点击弹出通知时,什么也没有发生(没有错误显示)。有人可以帮助我处理点击本地通知事件吗?
无错误显示。在调试模式下没有任何反应
Future<bool> _showNotification(Event event) async {
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
new FlutterLocalNotificationsPlugin();
var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon');
var initializationSettingsIOS = new IOSInitializationSettings();
var initializationSettings = new InitializationSettings(
initializationSettingsAndroid, initializationSettingsIOS);
flutterLocalNotificationsPlugin.initialize(initializationSettings,
onSelectNotification: onSelectNotification);
var androidPlatformChannelSpecifics = AndroidNotificationDetails(
'CHANNEL ID', 'CHANNEL NAME', 'CHANNEL DESCRIPTION',sound: 'message_vocal_rdv',importance: Importance.Max,
priority: Priority.High);
var iOSPlatformChannelSpecifics = new IOSNotificationDetails(sound: "slow_spring_board.aiff");
var platformChannelSpecifics = NotificationDetails(
androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(0, 'Octogone Group', 'Notification rendez-vous', platformChannelSpecifics,
payload: 'Hello Word');
return true;
}
Future onSelectNotification(String payload) async {
if (payload != null) {
debugPrint('payload is' + payload);}
await _navigationService.navigateTo(
NotificationDetailsRoute, arguments: payload);
}