I tried many different tutorials, followed e.g. this one https://medium.com/flutterpub/enabling-firebase-cloud-messaging-push-notifications-with-flutter-39b08f2ed723
But I'm not able to receive any Push-Notifications on my iPhone. It works perfectly on Android.
I use firebase_messaging: ^4.0.0+4 and flutter_local_notifications: ^0.6.1
The problem is that none of the listeners (onMessage, onResume or onLaunch) is getting called in iOS although a token is received with getToken()
There is no error message. I can't find the reason for this behavior. I would be glad if someone could help me out.
Thanks.
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print("IM HERE ON MESSAGE");
print('on message $message');
String message_as_String = json.encode(message);
print(message_as_String);
String title = "test";
String body = "test";
String screen = "test";
var androidPlatformChannelSpecifics = new AndroidNotificationDetails(
'your channel id', 'your channel name', 'your channel description',
playSound: false, importance: Importance.Max, priority: Priority.High);
var iOSPlatformChannelSpecifics =
new IOSNotificationDetails(presentSound: false);
var platformChannelSpecifics = new NotificationDetails(
androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
await flutterLocalNotificationsPlugin.show(
0,
body,
title,
platformChannelSpecifics,
payload: screen,
);
},
onResume: (Map<String, dynamic> message) async {
print('on resume $message');
String screen = message["screen"];
},
onLaunch: (Map<String, dynamic> message) async {
print('on launch $message');
},
);
if (Platform.isIOS) iOS_Permission();
_firebaseMessaging.getToken().then((token){
print(token);
});
}