OneSignal not registering on multiple devices - React Native

395 Views Asked by At

Currently I have managed to setup OneSignal properly on Android and iOS. The problem I am encountering however, is that the only devices that are subscribed and showing up in my OneSignal dashboard are the two initial devices. (One which is an emulated Pixel 3 XL and the other which is a real iPhone X) These two devices were setup following the OneSignal React Native documentation here https://documentation.onesignal.com/docs/react-native-sdk-setup

From my understanding, OneSignal automatically subscribes new devices to the dashboard with the OneSignal.init() method or OneSignal.setAppId() method for my case. I am not too sure if I have to have some additional code to support this.

Here is my entry file that works for the 2 initial devices.

index.js (changed app id to the default, to hide my actual one)

React.useEffect(() => {
    OneSignal.setAppId('ce8572ae-ff57-4e77-a265-5c91f00ecc4c');
    OneSignal.setLogLevel(6, 0);
    OneSignal.promptForPushNotificationsWithUserResponse(response => {
      console.log(response);
    });
  }, []);

Thanks for any help!

1

There are 1 best solutions below

0
On

This issue has been resolved. Turns out my code was not being run in my index.js file so moving it to App.js fixed it for me.