The android doc is missing the MainApplication.java inserts
I'm having the same issue 3.0.3 one Signal
this is done when you execute react-native link react-native-onesignal
@fermuch got the answer here... no need to include it in the docs since it's being done automatically during linking.
@avishayil I came across a problem this morning and realized the link function didn't do it job to add ReactNativeOneSignalPackage(). Shouldn't it be added to the docs just in case people missed it?
I had this same issue with OneSignal being undefined; the link function didn't update my MainApplication.java and I had to do it manually by following the example app config.
I will note that when I first ran the link function, it failed to work because react-native link thought that my Java files were in an intermediate folder, e.g. "could not find /android/app/src/main/java/com/MY_APP_NAME/ALPHA/MainApplication.java", but /ALPHA was a folder that wasn't actually in my file structure. My package was recently renamed to .com.MY_APP_NAME.alpha, in AndroidManifest.xml. I'm thinking perhaps react-native link looks at the package name to try to determine where your Java files are.
I agree that since this has happened to several people it would be helpful to add to the docs for troubleshooting.
Seems like react-native link react-native-onesignal does not update MainApplication.java in all cases, it didn't for me too. I suggest reopening this issue until the docs show how to link this library manually.
Most helpful comment
@avishayil I came across a problem this morning and realized the link function didn't do it job to add ReactNativeOneSignalPackage(). Shouldn't it be added to the docs just in case people missed it?