react-native-push-notification / ios

React Native Push Notification API for iOS.
MIT License
740 stars 284 forks source link

Foreground notification for iOS 14 #276

Closed iagormoraes closed 3 years ago

iagormoraes commented 3 years ago

The option Alert was deprecated in exchange of UNNotificationPresentationOptionAlert and UNNotificationPresentationOptionList, this means that iOS 14 or higher will not receive foreground push notifications with current version of this package.

Even calling completionHandler(UNNotificationPresentationOptionBanner); in AppDelegate it doesn't prompt the dialog in foreground.

iagormoraes commented 3 years ago

It seems was a bad setup to the AppDelegate file, it works with the documentation example:

completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge);

LightningNemesis commented 3 years ago

I am still unable to receive notifications in the foreground, and the documentation example I have used is

-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler { completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge); }

Could you help me out with this?

thijs-qv commented 3 years ago

This works for me.