We have to ship a receipt affirmation to our backend for a few of our push notifications, which we ship utilizing Firebase. With a purpose to obtain this, we ship background notifications, then ship the message id to our backend and show the notification in software(_:didReceiveRemoteNotification:fetchCompletionHandler:)
. For some motive this stopped working as didReceiveRemoteNotification
by no means appears to be known as.
We primarily ship the messages we’d like affirmation for like this:
closing var apnsConfig =
ApnsConfig.builder()
.setAps(Aps.builder().setContentAvailable(true).construct())
.putAllHeaders(Map.of("apns-push-type", "background", "apns-priority", "5"))
.putCustomData("customDataKey", "customDataValue")
.construct();
closing var multicastMessageBuilder =
MulticastMessage.builder()
.setApnsConfig(apnsConfig)
.addAllTokens(
fcmEntities.stream()
.map(FcmMessageEntity::getFcmRegistrationToken)
.toList());
multicastMessageBuilder.putAllData(
Map.of(
"notificationTitle",
notificationTitle,
"notificationBody",
notificationBody));
closing var batchResponse =
FirebaseMessaging.getInstance(firebaseService.getFirebaseApp())
.sendEachForMulticast(multicastMessageBuilder.construct());
We have now the “Background fetch” and “Distant Notifications” background modes enabled:
“Common” (seen) notifications are delivered advantageous.
We use Capacitor and their PushNotifications Plugin in case that is related.
What are we lacking/doing unsuitable?
We tried disabling the FirebaseAppDelegateProxy as some search outcomes instructed, however have been unsuccessful.
We additionally tried including UNUserNotificationCenterDelegate
to our AppDelegate, which led to didReceiveRemoteNotification
being known as on seen notifications solely whereas the app is within the foreground.