Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: cannot receive first push notification when app opened in foreground #627

Closed
Daha62 opened this issue Jun 8, 2020 · 13 comments
Closed

Comments

@Daha62
Copy link

Daha62 commented Jun 8, 2020

#508 - this issue is closed, but bug is still remains in react-native-notifications: 3.2.2

Notifications.events().registerNotificationReceivedForeground((notification, completion) => { completion({alert: true, sound: false, badge: false}) })

it always triggers when notification is sent but not always show system notifications

@taduyde
Copy link

taduyde commented Jun 12, 2020

Hi @Daha62,
Did you test it on Android device or iOS device?

@Daha62
Copy link
Author

Daha62 commented Jun 15, 2020

Hi @taduyde,

Android device is OK, problem is just on IOS

@taduyde
Copy link

taduyde commented Jun 15, 2020

Hi @taduyde,

Android device is OK, problem is just on IOS

hmm, it's so strange, but I think you have a problem with your setup of the plugin. From my side. This plugin works well on iOS.

@Daha62
Copy link
Author

Daha62 commented Jun 15, 2020

@taduyde, could u please show what u have in AppDelegate.m file?
cause i've done all that is written here https://wix.github.io/react-native-notifications/docs/getting-started#ios

also I have:

constructor(props) {
    super(props);
    Notifications.registerRemoteNotifications();
    Notifications.events().registerNotificationReceivedForeground((notification: Notification, completion) => {
      console.log(`Notification received in foreground: ${notification.title} : ${notification.body}`);
      completion({alert: true, sound: false, badge: false});
    });
  }

@taduyde
Copy link

taduyde commented Jun 15, 2020

Hi @Daha62,
Before I show you AppDelegate.m, I have a question to make sure I guess the issue you meet is correct. For the app in the background or app is "dead" you still received the notification or not?

@Daha62
Copy link
Author

Daha62 commented Jun 15, 2020

@taduyde

yep, I still received them.

I can receive them in foreground also (except first push)

@taduyde
Copy link

taduyde commented Jun 15, 2020

Here is my AppDelegate.m, it's just simple.

#import "RNNotifications.h"

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    [RNNotifications startMonitorNotifications];
    }

  • (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [RNNotifications didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
    }

  • (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
    [RNNotifications didFailToRegisterForRemoteNotificationsWithError:error];
    }

@Daha62
Copy link
Author

Daha62 commented Jun 15, 2020

thank u, unfortunately it's the same)

@geekdevs
Copy link

I have the same problem. First notification fails to show, afterwards everything's fine.

@stale
Copy link

stale bot commented Aug 22, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added 🏚 stale and removed 🏚 stale labels Aug 22, 2020
@kostiantyn-solianyk
Copy link

same issue, any updates

@egemenuzunali
Copy link

Just came across this issue, happens to me as well. First notification on foreground nothing, second shows.

@reeinohio
Copy link

I'm experiencing the same issue as well. Very first notification isn't received on iOS foreground but succeeding ones are received.

erkie added a commit to feederco/react-native-notifications that referenced this issue Oct 7, 2020
mburmistrov pushed a commit to mburmistrov/react-native-notifications that referenced this issue Jan 10, 2021
I can't see a reason why `RNNotifications.m` should have its own instance of `RNNotificationsStore` so I'm certain it's a bug. That  was what caused the notifications to not be shown the first time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants