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

OneSignal.shared.setNotificationReceivedHandler (not available ^3.2.7) #513

Closed
ArivhaySoft opened this issue Nov 19, 2021 · 5 comments
Closed

Comments

@ArivhaySoft
Copy link

ArivhaySoft commented Nov 19, 2021

V/OneSignal(21428): initWithContext called with: android.app.ReceiverRestrictedContext@39a85aa
V/OneSignal(21428): Starting OneSignal initialization!
V/OneSignal(21428): No class found, not setting up OSRemoteNotificationReceivedHandler
D/OneSignal(21428): OneSignal SDK initialization already completed.

I'm using version of onesignal_flutter: ^3.2.7 but for function setNotificationReceivedHandler I can't implement, I need this to give first action if any push come in

this is the code i usually use :

OneSignal.shared.setNotificationReceivedHandler((OSNotification notification) {
      this.setState(() {
        _debugLabelString = "Received notification: \n${notification.jsonRepresentation().replaceAll("\\n", "\n")}";
        print(_debugLabelString);

      });
    });

thanks in advance for the developers

@jkasten2
Copy link
Member

@ArivhaySoft The setNotificationReceivedHandler() was replaced by setNotificationWillShowInForegroundHandler(). See the OneSignal Flutter 3.x.x migration guide for more details on this new method.
https://documentation.onesignal.com/docs/flutter-30-api-reference#removed-functions

@emawby
Copy link
Contributor

emawby commented Jan 10, 2022

@Veloz-X Hello can you clarify what you mean by "receive data". Did you register a handler with setNotificationWillShowInForegroundHandler?

@hugoquintalcr
Copy link

There are two methods to use with notifications in one signal

setNotificationWillShowInForeground is a listener that It´s only used when you are into the app. But if you are outside of the app, you need to use setNotificationOpenedHandler but you need to press to the notification to listen it.

@silasrm
Copy link

silasrm commented Mar 14, 2022

See #509 (comment)

@emawby
Copy link
Contributor

emawby commented Jan 30, 2024

Closing issue as stale. If this is still happening in 2024 feel free to tag me to reopen

@emawby emawby closed this as completed Jan 30, 2024
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

5 participants