OneSignal Help & Documentation

Welcome to the OneSignal New IA developer hub. You'll find comprehensive guides and documentation to help you start working with OneSignal New IA as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussions

Troubleshooting React-Native

The following issues has been marked as repeating, therefore we decided to devote them a separate section.

Event Listeners (ie. opened or received) Not Firing

If you are having trouble getting events such as opened to fire correctly, there can be several causes.

Unmounted Components

The most common cause of event listeners not firing is if you use a component as an event listener that later gets unmounted. For example, if you have a sub-component in your app like a Profile Page, and you add that profile component as an event listener, everything will work when the profile page is mounted. However, when the user navigates to a different page in your app, the Profile page will get unmounted and your event listeners will be removed.

To troubleshoot this: use console.log statements for both addEventListener and removeEventListener, and make sure the last log statement was from code that was adding an event listener.

Background Execution

Please note that iOS and Android can be aggressive about preventing background app execution. This means that, in many cases, the received event will not fire when your app is in the background. Please consider using an Extension/Extender service in your app, but this will require writing native Objective-C/Java.

Bad Navigation/UI

Many developers put UI code in their opened or received event listeners, and when it doesn't work, immediately blame OneSignal's SDK for not firing the event listener, even though it generally turns out to be an issue with the UI related code. Please double check to make sure the event gets called using console.log or breakpoints.

Use of unresolved identifier 'RCTOneSignalExtensionService’

If you added the Notification Service Extension using Swift this sometimes complicates things a bit. Unless you want to customize how the extension service works (almost no one ever needs to do this), it is recommend to delete your extension service target completely, and re-create it with Objective-C, as outlined in our setup guide.

Android - Multiple dex files define:

> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzr;

Please make sure you have correctly followed the Adding the Gradle Plugin guide.

iOS - symbol(s) not found for architecture x86_64 and/or OneSignal/OneSignal.h file not found

Please double check the iOS Installation section as missing a step or entering an incorrect path will create these errors.

Make react-native-onesignal work with ExpoKit after ejecting from Expo-CRNA

If you have detached from Expo or CRNA, you might need to fix versions of the Google Play Services that this library is using to make it work nicely with ExpoKit (as of SDK23). Please make follow the Adding the Gradle Plugin guide which will make sure the correct versions are used.

Make react-native-onesignal work with Redux

Please see the examples/RNOneSignal/redux-index.js file for example code and comments. Note that it will not compile, but instead serves as a template for how to handle Redux integration in general, and specifically including the edge case for intercepting the onOpened event when a User taps a push notification and prompts the app to open from a previously unopened state.

Android - Multiple Libraries Android Errors

If you see this type of error:

Error: more than one library with package name 'com.google.android.gms.license'

or

java.lang.AbstractMethodError: abstract method "void com.google.firebase.iid.zzb.zzd(android.content.Intent)"

This error means there was a mixture of different Firebase modules included in your app. If you add our OneSignal Gradle Plugin this will fix the version issue in your project and should resolve that runtime error.

If you already have this in your build.gradle, make sure it the section noted in the docs is at line 1 of the file. Also make sure this is added to your app/build.gradle instead of the android/build.gradle or the root one.

Here is a quick reference to add the OneSignal Gradle plugin your app's build.gradle file:

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.2, 0.99.99]'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'