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

NotificationsIOS.consumeBackgroundQueue() OR NotificationsIOS.getInitialNotification() Doesn't work with react-native 59.5 #339

Closed
ko100v opened this issue Jul 4, 2019 · 2 comments

Comments

@ko100v
Copy link

ko100v commented Jul 4, 2019

I'm trying to receive a local or push notification from dead state, but its not working.

componentDidMount() {
       setNotificationsListeners()
       NotificationsIOS.requestPermissions()
       NotificationsIOS.consumeBackgroundQueue()
       this.navigationEventListener = Navigation.events().bindComponent(this);

       setInterval(() => {
           NotificationsIOS.getInitialNotification().then((notif) => {
               NotificationsIOS.consumeBackgroundQueue()
               console.log('notif: ', notif)
           }).catch((e) => {
               console.log('catch: ', e)
           })
       }, 1000)
   }

export function setNotificationsListeners() {
    if (Platform.OS === PLATFORMS.IOS) {
        NotificationsIOS.addEventListener(NOTIFICATION_RECEIVED_FOREGROUND_IOS, notification => {
            console.log('foreground: ', notification);
        })
        NotificationsIOS.addEventListener(NOTIFICATION_RECEIVED_BACKGROUND_IOS, notification => {
            console.log('backgroundios notif: ', notification)
        })

        NotificationsIOS.addEventListener(NOTIFICATION_OPENED_IOS, (notification) => {
            console.log('opened: ', notification);
        })
    } else {
        NotificationsAndroid.setNotificationReceivedListener((notification) => {

            console.log('foreground: ', notification)

        })

        NotificationsAndroid.setNotificationOpenedListener((notification) => {
            // inAppNotificationPressed(parseNotification(notification))
            console.log('android open: ', notification)

        })
    }
}

package.json:
"react": "16.8.3",
"react-native": "0.59.5",
"react-native-notifications": "^1.5.0",
"react-native-navigation": "^2.21.0",

@yogevbd
Copy link
Collaborator

yogevbd commented Jul 29, 2019

Fixed in latest version. please follow the updated installation guide

@yogevbd yogevbd closed this as completed Jul 29, 2019
@nihp
Copy link

nihp commented Feb 26, 2020

I am getting the error in (_reactNativeNotifications.default.addEventListener)

Due to the NotificationsIOS.addEventListener() in my file.

How can i resolve this.

chrisbobbe pushed a commit to chrisbobbe/zulip-mobile that referenced this issue Mar 3, 2020
…ound.

This is a short-term fix that relies on a deprecated API. We should
upgrade to a newer version of react-native-notifications or use
@react-native-community/push-notification-ios instead.

For now-outdated docs on this, see
wix/react-native-notifications@fe30ae5#diff-d455ef90f34ba49d565c96e9f2cc8b98R53-R58.
The API was removed in release 2.0.6-shapshot-8 with commit
wix/react-native-notifications@8006691,
presumably in response to
wix/react-native-notifications#339.

Process an opened notification from the "background queue" so our
handleNotificationOpen will run, and the app will navigate, for a
notification opened while the app was in the background.

Fixes: zulip#3647
chrisbobbe pushed a commit to chrisbobbe/zulip-mobile that referenced this issue Mar 3, 2020
…ound.

This is a short-term fix that relies on a deprecated API. We should
upgrade to a newer version of react-native-notifications or use
@react-native-community/push-notification-ios instead.

For now-outdated docs on this, see
wix/react-native-notifications@fe30ae5#diff-d455ef90f34ba49d565c96e9f2cc8b98R53-R58.
The API was removed in release 2.0.6-shapshot-8 with commit
wix/react-native-notifications@8006691,
presumably in response to
wix/react-native-notifications#339.

Process an opened notification from the "background queue" so our
handleNotificationOpen will run, and the app will navigate, for a
notification opened while the app was in the background.

Fixes: zulip#3647
chrisbobbe pushed a commit to chrisbobbe/zulip-mobile that referenced this issue Mar 7, 2020
…ound.

This is a short-term fix that relies on a deprecated API. We should
upgrade to a newer version of react-native-notifications or use
@react-native-community/push-notification-ios instead.

For now-outdated docs on this, see
wix/react-native-notifications@fe30ae5#diff-d455ef90f34ba49d565c96e9f2cc8b98R53-R58.
The API was removed in release 2.0.6-shapshot-8 with commit
wix/react-native-notifications@8006691,
presumably in response to
wix/react-native-notifications#339.

Process an opened notification from the "background queue" so our
handleNotificationOpen will run, and the app will navigate, for a
notification opened while the app was in the background.

Fixes: zulip#3647
chrisbobbe pushed a commit to chrisbobbe/zulip-mobile that referenced this issue Mar 9, 2020
…ound.

This is a short-term fix that relies on a deprecated API. We should
upgrade to a newer version of react-native-notifications or use
@react-native-community/push-notification-ios instead.

For now-outdated docs on this, see
https://github.com/wix/react-native-notifications/blob/882775fb5/docs/notificationsEvents.md.
The API was removed in release 2.0.6-shapshot-8 with commit
wix/react-native-notifications@8006691,
presumably in response to
wix/react-native-notifications#339.

Process an opened notification from the "background queue" so our
handleNotificationOpen will run, and the app will navigate, for a
notification opened while the app was in the background.

Fixes: zulip#3647
gnprice pushed a commit to chrisbobbe/zulip-mobile that referenced this issue Mar 9, 2020
…und.

This is a short-term fix that relies on a deprecated API. We should
upgrade to a newer version of react-native-notifications or use
`@react-native-community/push-notification-ios` instead.

For docs on this as of the library version we're using (1.5.0 on NPM,
which has no Git tag but corresponds to commit 882775fb5), see:
  https://github.com/wix/react-native-notifications/blob/882775fb5/docs/notificationsEvents.md

The API was removed in release 2.0.6-shapshot-8 with commit:
  wix/react-native-notifications@800669120
presumably in response to:
  wix/react-native-notifications#339

Process an opened notification from the "background queue" so our
handleNotificationOpen will run, and the app will navigate, for a
notification opened while the app was in the background.

Fixes: zulip#3647
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

3 participants