You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, in the firebase messaging version: 5.4.1 To get New from firebase, we did this: FirebaseMessaging _fcm = FirebaseMessaging ();
But in the version of firebase messaging: 9.1.3 I have problem for New from firebase
thank you for your help.
The text was updated successfully, but these errors were encountered:
This works for me, with Firebase Messaging v10.0.3
class PushNotificationService {
final FirebaseMessaging _fcm = FirebaseMessaging.instance;
final NavigationService _navigationService = locator<NavigationService>();
Future initialise() async {
NotificationSettings settings = await _fcm.requestPermission(
alert: true,
announcement: false,
badge: true,
carPlay: false,
criticalAlert: false,
provisional: false,
sound: true,
);
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
print('User granted permission');
} else if (settings.authorizationStatus ==
AuthorizationStatus.provisional) {
print('User granted provisional permission');
} else {
print('User declined or has not accepted permission');
}
// workaround for onLaunch: When the app is completely closed (not in the background) and opened directly from the push notification
_fcm.getInitialMessage().then((RemoteMessage message) {
print('getInitialMessage data: ${message.data}');
_serialiseAndNavigate(message);
});
// onMessage: When the app is open and it receives a push notification
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
print("onMessage data: ${message.data}");
});
// replacement for onResume: When the app is in the background and opened directly from the push notification.
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
print('onMessageOpenedApp data: ${message.data}');
_serialiseAndNavigate(message);
});
}
void _serialiseAndNavigate(RemoteMessage message) {
...
}
}
Hi, in the firebase messaging version: 5.4.1 To get New from firebase, we did this:
FirebaseMessaging _fcm = FirebaseMessaging ();
But in the version of firebase messaging: 9.1.3 I have problem for New from firebase
thank you for your help.
The text was updated successfully, but these errors were encountered: