Unable to get notification on ios
Closed this issue · 5 comments
Hi Folks,
I want to add flutter push to my application but even after following the steps mentioned in the documentation I am unable to get the test notification, I get the error bad apns token.
Also cleverTap picks up fcm token for Ios by default can this be the reason, as I am able to get notification from firebase cloud messaging
Hi @manavk11
Can you help me with these questions to understand the issue:
- Does this happening sometime, or you are not getting push at all from CleverTap?
- Are you getting push from CleverTap when you not using along with Firebase?
- Try integrating CleverTap manually if you want to use Firebase along with our SDK and try to test push from both places. Here is the doc for manually integrating push in iOS: https://developer.clevertap.com/docs/push-notifications-ios#manually-integrating-push-notification-support
Hi @nishant-clevertap,
This is only in Ios
So the issue that I am facing is whenever I get a notification in foreground from Firebase, it is getting rendered natively as I have added
` override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.badge, .sound, .alert])
}`
in AppDelegate.swift. Due to this the fcm code doesn't get called.
` FirebaseMessaging.onMessage.listen((RemoteMessage message) {
print('Got a message whilst in the foreground!');
print('Message data: ${message.data}');
print('Message Notification: ${message.notification?.title}');
RemoteNotification? notification = message.notification;
AndroidNotification? android = message.notification?.android;
AppleNotification? apple = message.notification?.apple;
Map<String, dynamic>? data = message.data;
if (notification != null && !message.data.containsKey('meta')) {
NotificationDetails platformChannelSpecifics = NotificationDetails(
android: android != null
//TODO: create channels
? AndroidNotificationDetails(
'0',
'BroadCast',
importance: Importance.max,
priority: Priority.high,
icon: android.smallIcon,
)
: null,
iOS: apple != null
? DarwinNotificationDetails(
presentAlert: true, // Show an alert
presentBadge: true, // Apply a badge
presentSound: true, // Play a sound
)
: null,
);
flutterLocalNotificationsPlugin.show(notification.hashCode,
notification.title, notification.body, platformChannelSpecifics,
payload: jsonEncode(data));
} else {
if (message.data.isNotEmpty && message.data.containsKey('meta')) {
print("SHOW NOTIFICAIONT");
try {
NotificationRemoteData remoteData =
NotificationRemoteData.fromJson(message.data);
showNotification(remoteData, payload: jsonEncode(message.data));
} catch (e, s) {
print("FOREGROUND NOTIFICATION ERRORR");
print(e);
print(s);
}
}
}
/* if (message.notification != null) {
print("THIS CALLED");
flutterLocalNotificationsPlugin.show(
message.notification.hashCode,
message.notification!.title,
message.notification!.body,
NotificationDetails(
android: AndroidNotificationDetails(
"0",
"BroadCast",
),
),
payload: jsonEncode(message.data));
}*/
});
`
Can you guide me with integrating cleverTap along with firebase.
Hi @manavk11
If you want to integrate CleverTap along with Firebase, try integrating CleverTap SDK manually, here is the doc which you can refer: https://developer.clevertap.com/docs/push-notifications-ios#manually-integrating-push-notification-support. This will help you getting push from both places.
Hi @nishant-clevertap ,
I am having similar issue with notifications on iOS. It says bad apns token everytime notification is trigered.
Details:
- I'm not using any other Notifications Service along on CleverTap.
- I have also cross checked apns key and mode -> development (as described in the errors section)
Here are my environment details
clevertap_plugin: ^2.4.0
Flutter 3.19.5 • channel stable
Dart 3.3.3
Hi @musharaf-at-NGI
Can you create a support ticket for this, they will help you out with these errors. This place is for Github issues for the SDKs.
Thanks.
@manavk11 Closing this ticket as this is resolved.