configure method
Configure and set up the notification manager. Also tries to get permissions to send notifications.
Implementation
@override
Future<void> configure() async {
tz.initializeTimeZones();
// Registers the notification icon - without it every show() throws on Android.
await FlutterLocalNotificationsPlugin().initialize(
settings: const InitializationSettings(
android: AndroidInitializationSettings('ic_launcher'),
iOS: DarwinInitializationSettings(),
),
onDidReceiveBackgroundNotificationResponse:
onDidReceiveNotificationResponse,
onDidReceiveNotificationResponse: onDidReceiveNotificationResponse,
);
// Not permission_handler: it never completes its future if the dialog is dismissed.
var granted = await FlutterLocalNotificationsPlugin()
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin
>()
?.requestNotificationsPermission();
debug('$runtimeType - Notification permission granted: $granted');
info('$runtimeType configured.');
}