I have only been working on Android push notification, Now I want to work on IOS , I have all the required fields like developer account etc covered. I can in fact receive a push notification but as I click on it i want a dialogue box to open retrieveRideRequestInfo
.The code below works fine with Android. However with IOS nothing happens as I am unsure what else is needed because the documentation is too complicated for me.
class PushNotificationService {
FirebaseMessaging firebasemessaging = FirebaseMessaging.instance;
Future initialize(context) async {
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
RemoteNotification? notification = message
.notification;
AndroidNotification? android = message.notification?.android;
if (notification != null && android != null) {
retrieveRideRequestInfo(getRideRequestId(message.data)!, context);
flutterLocalNotificationsPlugin.show(
notification.hashCode,
notification.title,
notification.body,
NotificationDetails(
iOS: IOSNotificationDetails(),
android:
AndroidNotificationDetails(channel.id, channel.name,
channelDescription: channel.description,
color: Colors.blue,
playSound: false,
icon: '@mipmap/ic_launcher'),
),
);
print('AndroidNotification after clicking ' + notification.title!);
print('AndroidNotification after clicking ' + notification.body!);
print("This is message map");
}
});
//on message open
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
// same as above
RemoteNotification? notification = message
.notification; //assign two variables for remotenotification and android notification
AndroidNotification? android = message.notification?.android;
if (notification != null && android != null) {
// if (doublenotification.isOdd)
retrieveRideRequestInfo(getRideRequestId(message.data)!, context);
print('AndroidNotification after clicking ' + notification.title!);
print('AndroidNotification after clicking ' + notification.body!);
//getRideRequestId();
}
//}
});
}
The docs specify if (notification != null && android != null) {}
which is only taking care of android, How can I handle Ios notifications then ?