question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[docs] [expo-notifications] missing instructions for notifications listeners to work on iOS when adding the library to an existing app

See original GitHub issue

When adding expo-notifications in an existing react-native application, notification listeners does not fire on iOS unless we set the expo-notifications delegate in didFinishLaunchingWithOptions function in the file AppDelegate.m

id<EXNotificationCenterDelegate> notificationCenterDelegate = (id<EXNotificationCenterDelegate>) [UMModuleRegistryProvider getSingletonModuleForClass:[EXNotificationCenterDelegate class]];

[[UNUserNotificationCenter currentNotificationCenter] setDelegate:(id<UNUserNotificationCenterDelegate>) notificationCenterDelegate];

I think this must be added to the installation part of the docs, so it will be clear for the future users . https://docs.expo.io/versions/latest/sdk/notifications/#installation

Nice library by the way , thanks for your efforts!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mreda7commented, Oct 12, 2020

Hello @sjchmiela !
I tested your suggestions and it works 😃.

I think it will be a great if you included also the changes that we have to make in AppDelegate.h when configuring Unimodules fo iOS.

Thanks !

1reaction
Enricopvcommented, Oct 21, 2020

I just want to confirm that applying the changes in the two commits (https://github.com/expo/expo/pull/10637/commits) to AppDelegate.h and AppDelegate.m fixed this iOS notification listener issue I had been having for a while!

Thanks so much for figuring it out!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Notifications - Expo Documentation
Please note: In order to handle notifications while the app is backgrounded on iOS, you must add remote-notification to the ios.infoPlist.UIBackgroundModes key ...
Read more >
Use notifications on your iPhone or iPad - Apple Support
Tap a single notification to open the app that it's from. Tap a group of notifications to view all recent notifications from that...
Read more >
Receive messages in a Flutter app - Firebase - Google
On iOS, if the user swipes away the application from the app switcher, it must be manually reopened for background messages to start...
Read more >
How to create and send push notifications in React Native
Both FCM and APNs are platform-specific native push notification services, so we typically have to use different libraries in the app's front ...
Read more >
NavigationContainer | React Navigation
The NavigationContainer is responsible for managing your app state and linking your top-level navigator to the app environment.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found