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

Starting application from background with notification happens in foreground (iOS) #590

Closed
yedidyak opened this issue Feb 28, 2018 · 4 comments

Comments

@yedidyak
Copy link
Contributor

When trying to test opening an application from the background with a push notification with this code:

await device.sendToHome();
await device.relaunchApp({ newInstance: false, userNotification });

The notification is sent to the application but only after the native UIApplicationState is already changed to UIApplicationStateActive. This makes the application behave as if the notification was opened when the app was already in the foreground.

The same behaviour happens when trying like this:

await device.sendToHome();
await device.sendUserNotification(userNotification);
await device.relaunchApp({newInstance: false});

@LeoNatan

@LeoNatan
Copy link
Contributor

Thanks

@LeoNatan
Copy link
Contributor

LeoNatan commented Feb 28, 2018

Just to prepare you, @yedidyak, you are relying on bad practice in your application. The application states you rely on are Apple implementation detail, and should not be relied upon in production code. For example, you are using an old, deprecated API. Using the new UserNotifications API brings a different Apple implementation and application states are different there.

The more I think about the solution to fix this issue (and how much it complicates the system), the more resistant I am to fixing it. Will discuss more with @rotemmiz, but just be prepared for this possible outcome.

@LeoNatan
Copy link
Contributor

Further discussed with @rotemmiz. We have decided to mark this as "wontfix" and close. We plan to remove support of this deprecated API in Detox soon anyway.

All is not lost, because we have a guild task to upgrade react-native-notifications to use the new Apple API instead of the old one. So it will be solved one way or another.

@rotemmiz
Copy link
Member

For the sake of history, this was indeed a bug, which was handled in #604, by changing the way notifications and urls are being sent while application is in background.

@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants