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

[question]: How to handle the scenario when the app is terminated and the iPhone is locked? #679

Closed
1 task done
joaofyz opened this issue May 9, 2023 · 4 comments
Closed
1 task done

Comments

@joaofyz
Copy link

joaofyz commented May 9, 2023

How can we help?

Hi,

I'm developing a Flutter app and using the OneSignal to push notifications.

In this scenario (iPhone locked with app terminated), it seems that, when the phone receives the push notification, the app root screen is launched automatically by the iOS (the OneSignal.shared.setNotificationOpenedHandler is only called when the user clicks in the push notification).

Is this correct?

If so, how I can handle this scenario in order to identify in the root screen that the app was launched due to being received a push notification? If I cannot control this, the root screen will have the default behavior and navigate to some screen as it happens when the app is opened normally (not by a push notification)?

Thanks in advance for your contributions.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@emawby
Copy link
Contributor

emawby commented May 11, 2023

@joaofyz To clarify your question are you saying that the notification opened handler is not being fired when the app is launched via tapping on a push notification when the app is killed?

@joaofyz
Copy link
Author

joaofyz commented May 12, 2023

Hello @emawby

No, when we tap the push the handler is called correctly.

But in iOS when you have killed the app and the phone is locked, when you receive the push, your app is launched by the OS automatically even if you do not click on anything and the handler will only be called once you tap the push notification.

I wanted to know if there's any way to detect on the automatic launch that the app was launched because we received a push notification?

Thanks

@emawby
Copy link
Contributor

emawby commented May 17, 2023

@joaofyz I am not familiar with the behavior you are describing. Are you experiencing the app being launched into the foreground whenever you receive a push notification?

@jennantilla
Copy link
Contributor

Closing due to no response. @joaofyz if you are still having issues, please let us know.

We have released major updates to the Flutter SDK which includes many improvements and enhancements. Please refer to our migration guide for full details!

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