initializeNotifications method
Initialize push notifications (with default channel for Android).
- Uses app id as the channel id.
Implementation
Future<void> initializeNotifications({
required String appId,
String? channelName,
}) async {
// Check if the app requires notification permission (Android 13+ or iOS).
await requestNotificationPermission();
// Initialize Firebase Messaging
await _initializeFirebaseMessaging();
/// Register device token for notifications.
await registerDeviceToken();
/// Set foreground message handler
setForegroundMessageHandler();
/// Set notification open app handler
setNotificationOpenAppHandler();
}