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
(Android) E/onesignal: Unable to initialize the OneSignal SDK because activity is null true or oneSignalInitDonefalse #516
Comments
@aspidvip can you please provide some more details? Does this error throw an exception and crash, or does it just not work (no player id, unable to receive push notifications, etc)? What are the symptoms? |
I had this problem too. I think it's because of react-native-navigation. It launches another activity just after the application launches. If you call If you wait for a few seconds before calling |
I solved by just using
and that's it. Way simpler than doing it from JS side if you're using react-native-navigation. |
no player id, unable to receive push notifications! |
@urbancvek That same initialization technique (using AppDelegate for iOS and gradle for Android) also works in 3.2.3 @aspidvip That is a very broad issue, it could be anything. This likely is an issue with react-native-navigation and the timing of your OneSignal initialization |
I did
|
@aspidvip can you post your Also, you might try going into the |
|
@aspidvip This means that the Android API level in
What matters most is that they match. You could also just go into |
matching the build.gradle files did not fix it |
@hamadasamir85 I have no idea what your environment looks like, what dependencies you are using, and so on. So far aspidvip is the only person to post their build.gradle and other details. This is a broad issue and can have many potential causes. Please post some of the same details I've asked aspidvip. @aspidvip Please let me know if matching the versions works/doesn't work, and also let me know what Android API levels you tried/didn't try. And frankly, it would really help if you could send a demo project that reproduces this issue. |
Same Issue: On a fresh react native project package.json
logcat
App.js
build.gradle
By the way, I star a fresh project because was impossible to make it works on a existing project. |
To anyone who is also having this issue, it’s generally because of your app’s particular navigation stack. It can usually be fixed by using native initialization of the SDK as @urbancvek noted above. Please note that the SDK still supports native initialization (without using JS), you don’t have to go back to 3.1.4. |
@cesarve77 @aspidvip Can either of you post your |
Yes, but Im new in One signal and I could not find the documentation
2018-06-09 12:03 GMT+10:00 Brad Hesse <notifications@github.com>:
… @urbancvek <https://github.com/urbancvek> please note that the SDK still
supports native initialization (without using JS), you don’t have to go
back to 3.1.4.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#516 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADyXp8VcHWtSuGuhqu6GAmhuwEAs28yJks5t6y0MgaJpZM4UFgCX>
.
|
I'll do it later.
2018-06-12 11:19 GMT+10:00 Brad Hesse <notifications@github.com>:
… @cesarve77 <https://github.com/cesarve77> @aspidvip
<https://github.com/aspidvip> Can either of you post your
MainApplication.java?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#516 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADyXp85jPYJ5TPNv7xwQt_3CoZ-rNvsuks5t7xcSgaJpZM4UFgCX>
.
|
I tried to update and use the new instructions from the new readme. After some tries I I tested 3.2.4, 3.2.3 ... and each time I had an issue. So I picked the version of one of my other project. To resume I have the old implementation (native side) https://github.com/geektimecoil/react-native-onesignal/blob/732491fece1fa92946ca6dacf173af28a2b2e618/README.md and I call Issue on 3.2.3 : |
@nicovak that likely means you’re using some dependency like We’re working on a solution to this, in the mean time, downgrading to 3.0.7 is a good idea if you’re experiencing this particular issue. |
@Nightsd01 yes I am using I declared event listener in my App.js (included in index.js), these listeners update my store with desired values. Like that I can call functions easily when I need to. Before event listeners were declared in my store. I also had a little issue when the app was closed: I didn't receive the event In my App.js import OneSignal from "react-native-onesignal";
OneSignal.configure({});
OneSignal.addEventListener("opened", openResult => {
AppStore.handleOpenIfAppClosed(openResult);
});
OneSignal.addEventListener("ids", device => {
AppStore.handleUserId(device);
});
@observer
export default class App extends Component { In my store handleOpenIfAppClosed(openResult) {
this.pendingNotificationRequest = openResult;
}
handleUserId(device) {
this.userId = device.userId;
} |
@nicovak How did you fix the main issue (activity is null)? Also, with the |
@Nightsd01 I am not using the last version (3.0.7), that's how I fix activity is null issue. Issue on 3.2.3 : Unable to initialize the OneSignal SDK because activity is null true or oneSignalInitDonefalse Issue on 3.2.4: You must initialize OneSignal before getting tags! Moving this tag operation to a pending queue. |
@nicovak You can ignore that warning in 3.2.4. It means what it says: your app is somehow calling If that's the only problem you are having in 3.2.4, I would heavily recommend updating back to 3.2.4 since it fixes many issues that were present in 3.0.7. |
@Nightsd01 Ok, thank you, I'll give It a try tomorrow with my actual setup 👍 |
@Nightsd01 I tried to update to 3.2.4 again but impossible to get It work. I tried native initialization and javascript initialization. I put code in App |
@Nightsd01 Thank you so much, you rock. I'll upgrade and test It next monday if it's available. |
The new update (3.2.5) has been released! If anyone else encounters a similar issue please post here and we'll be happy to investigate |
I have the issue again with
|
Hello!
"react-native": "0.55.3",
"react-native-onesignal": "^3.2.3",
app.js
work on iOS
not work on Android
The text was updated successfully, but these errors were encountered: