EDIT: This issue is fixed on the latest flutter and firebase version.
I'm listening to Firebase FCM data
type messages and on receiving FCM messages, I intended to show a local notification from within the app.
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print('on message $message');
LocalNotificationService.showNotoficationWithDefaultSound("onmessage");
},
onResume: (Map<String, dynamic> message) async {
LocalNotificationService.showNotoficationWithDefaultSound("onresume");
print('on resume $message');
},
onLaunch: (Map<String, dynamic> message) async {
LocalNotificationService.showNotoficationWithDefaultSound("onlaunch");
print('on launch $message');
},
onBackgroundMessage: myBackgroundMessageHandler,
);
/// Yes. This is a global function
Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) {
var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
'chanID_007', 'chanName_kk107', 'This is my channel');
var iosPlatformChannelSpecifics = new IOSNotificationDetails();
var platformChannelSpecifics = new NotificationDetails(
androidPlatformChannelSpecifics, iosPlatformChannelSpecifics);
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
var initializationSettingsAndroid =
new AndroidInitializationSettings('@mipmap/ic_launcher');
var initializationSettingsIos = new IOSInitializationSettings();
var initializationSettings = new InitializationSettings(
initializationSettingsAndroid, initializationSettingsIos);
flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
flutterLocalNotificationsPlugin.initialize(initializationSettings,
onSelectNotification: onSelectNotification);
await flutterLocalNotificationsPlugin.show(
0, 'Tada!!', 'test', platformChannelSpecifics,
payload: 'payload#7');
print("background mssg");
}
But showing the local notification with flutter_local_notification plugin throws an error
Unhandled Exception: MissingPluginException(No implementation found for method initialize on channel dexterous.com/flutter/local_notifications)
What am I missing here?