androidiosreact-nativepush-notificationunnotificationserviceextension

How to modified remote notification body content in ios using react native


we made mobile app using react native. In this we used below library for push notification.

"@react-native-community/push-notification-ios": "^1.11.0", "react-native-push-notification": "8.1.1",

Now we want to modified remote notification body content in ios app.

In ios app we tried to add notification service extension but not working.Notification service extension methods are not called when notification getting and same things working in demo app created for service extension.

Service extension method :-

we define below things in Appdelegate didfinishlanuch method :-

 UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
 [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound + UNAuthorizationOptionBadge)completionHandler:^(BOOL granted, NSError * _Nullable error) {
       if (granted) {
          center.delegate = self;
        }
}];

So any one have Solution then please help us.

Thank you

Shraddha vaishnani


Solution

  • You have to send data only notification(without title and message) in your notification server. The remote notification will be arrived though the background notification will not be showed. Then you should prompt local notification with the customized title and message by using react-native-push-notification.