-
Notifications
You must be signed in to change notification settings - Fork 376
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
[Bug]: opted in state stops updating on Android after app restarted #1625
Comments
Thanks! I just verified that by upgrading to |
I just tried this on a fresh install of bare React Native 0.73.2 (well, the React Native reproducer template), following the steps in the SDK setup docs to verify it wasn't an Expo or setup issue and added some logging to make sure OneSignal was initializing and the listeners were registering (which is a step recommended in the troubleshooting docs). I also added a button to call |
I downgraded my upgrade PR back to v4, which is what I'm going to use until this is fixed. |
@chriszs I have the same situation, when running initialize I can't get the user token. |
We're facing this issue as well with v5.0.6. We've rolled back to v4.5.2 until this is resolved. |
We are also encountering this in v5.0.6. Exact same behavior where getOptedIn returns false despite logcat indicating that the optIn is sending the API request successfully and the eventListener never seems to acknowledge the change. |
Hello everyone! Thank you for your patience. We just released 5.1.0 which ensures that the push subscription opted in state, token, and id are accessed asynchronously so the correct values are given every time. We have deprecated Please let us know if you have any additional questions or concerns! |
What happened?
The opt-in and opt-out states stop updating on Android after the app is killed and restarted once or twice. The listener doesn't fire and
getOptedIn
returns the wrong value.Steps to reproduce?
git clone -b onesignal-bug-demo https://github.com/chriszs/test-expo-app.git
cd test-expo-app
npm i
echo "EXPO_PUBLIC_ONESIGNAL_APP_ID=<ONESIGNAL_ID_HERE>" > .env
npx expo run:android
What did you expect to happen?
I expected the push subscription change event to trigger and the opted-in state to update when the user opts in or out even after the app is restarted.
React Native OneSignal SDK version
5.0.4
Which platform(s) are affected?
Relevant log output
When I first run the app, it works as expected, and I see a log like:
But after killing the app (swiping up on the card) and then reopening it, the event fires maybe once or not at all per opt in or out, and the opted-in state I can access is stuck either opted-in or opted-out, despite logs indicating a 200 success API PATCH operation. Here's what a restart and a couple toggles looks like:
Code of Conduct
The text was updated successfully, but these errors were encountered: