-
Notifications
You must be signed in to change notification settings - Fork 375
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]: App crashes on subsequent open on Android #1637
Comments
Also having this issue "expo": "~49.0.15" |
I am using "expo": "~49.0.15", but I'm not experiencing the issue. What I have done is that I initialized the OneSignal early on app launch in my App.js as below OneSignal.initialize(oneSignalAppId); Check for permission next const requestPermissions = async() => {
// Also need enable notifications to complete OneSignal setup
if (await OneSignal.Notifications.canRequestPermission()) {
let permission = OneSignal.Notifications.hasPermission();
if (!permission) {
await OneSignal.Notifications.requestPermission(true);
}
}
OneSignal.setConsentRequired(true);
OneSignal.setConsentGiven(true);
}
useEffect(() => {
requestPermissions();
}, []); then call login late during App load to allow it initialize and also used OneSignal.login(userData?.username.toLowerCase()); You can also subscribe to permissionChange event to determine when permission changes I hope this helps |
Hello everyone! This appears to be related to #1639 which is currently in review. Additional reports of this issue are being tracked in #1554 so for consolidation sake I'm going to close this issue and you can follow updates there. Please let me know if you believe this to be different and we will revisit. Thank you for your patience! |
Thanks for the pointer @opmat I initialized it in App.ts
Then request permission in a Root component with a slightly modified code.
I hope this helps someone in the future 👊🏼 |
What happened?
When the app is installed and open for the first time it works fine, however force closing and re-opening leads to on open. Below is the error from Crashlytics.
Steps to reproduce?
Error 2 (Detail on the second error from the Crashlytics screenshot):
The text was updated successfully, but these errors were encountered: