onFirebaseMessagingInitialize method
Future<void>
onFirebaseMessagingInitialize({
- required NotificationHandler onFirebaseNotificationClickedInBackground,
Implementation
Future<void> onFirebaseMessagingInitialize({required NotificationHandler onFirebaseNotificationClickedInBackground}) async{
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
await FirebaseMessaging.instance.requestPermission(alert: true,badge: true,sound: true);
await flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()?.createNotificationChannel(channel);
await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
alert: true,
badge: true,
sound: true,
);
onFirebaseNotificationReceived();
onClickedInBackground(onFirebaseNotificationClickedInBackground);
}