React-native-onesignal: ids event does not fire on app load

Created on 13 May 2018  Â·  14Comments  Â·  Source: OneSignal/react-native-onesignal

Code:

entry index.js file

componentWillMount() {
    OneSignal.init("YOUR_ONESIGNAL_APPID");

    OneSignal.addEventListener('ids', this.onIds);
}

componentWillUnmount() {
    OneSignal.removeEventListener('ids', this.onIds);
}

onIds(device) {
    console.log('Device info: ', device);
}

Question:
This does not fire ids event on load.

Versions:
"react": "16.0.0-alpha.12",
"react-native": "0.48.3",
"react-native-onesignal": "^3.2.1",

gradle and build settings are as per your example code.

Most helpful comment

If you want the ids event to fire, you can call OneSignal.configure(), which will trigger the ids event. I recommend doing this after calling init() of course.

All 14 comments

same problem

Same problem

Hi @hiteshagja can you confirm if your Xcode project is linking to react-native-onesignal correctly? It would look like this:

alt text

Verified also happening for me. I checked, my project looks fine.

@Nightsd01 I have not checked iOS yet but it's not working in Android.

If you want the ids event to fire, you can call OneSignal.configure(), which will trigger the ids event. I recommend doing this after calling init() of course.

yeah I did init(), then listeners, then configure, and it began working!

On Mon, May 14, 2018 at 6:14 PM, Brad Hesse notifications@github.com
wrote:

Just to be sure - you are adding the event listeners before you call
OneSignal.init(), correct?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/geektimecoil/react-native-onesignal/issues/501#issuecomment-388992157,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AATQay8uLvFT3T-zBljgr46dYl62lFrNks5tyg_sgaJpZM4T8x9Z
.

--

Jordan Prince | Software Engineering
Caradvise.com | O: 301.751.7354 | C: 301.751.7354

This e-mail is only intended for the person(s) to whom it is addressed and
may contain confidential information. Any unauthorized review, use,
disclosure, or distribution is prohibited. If you received this e-mail in
error, please notify the sender by reply e-mail and then delete this
message and any attachments from your system. Thank you for your
cooperation.

its did. but notification not received in emulator. i dono why. whats the problem for emulator and real phone for one signal.

@Nightsd01

Thank you.

I'm experiencing the same issue on Android in 3.2.3

I got this error in logcat:
E/OneSignal: Unknown error getting FCM Token
java.lang.NoSuchMethodError: No static method isDeviceProtectedStorage(Landroid/content/Context;)Z in class Landroid/support/v4/content/ContextCompat; or its super classes (declaration of 'android.support.v4.content.ContextCompat' appears in /data/app/com.motoshubapp-2/base.apk)
at com.google.firebase.FirebaseApp.zza(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.onesignal.PushRegistratorFCM.initFirebaseApp(PushRegistratorFCM.java:64)
at com.onesignal.PushRegistratorFCM.getToken(PushRegistratorFCM.java:50)
at com.onesignal.PushRegistratorAbstractGoogle.attemptRegistration(PushRegistratorAbstractGoogle.java:97)
at com.onesignal.PushRegistratorAbstractGoogle.access$100(PushRegistratorAbstractGoogle.java:37)
at com.onesignal.PushRegistratorAbstractGoogle$1.run(PushRegistratorAbstractGoogle.java:84)
at java.lang.Thread.run(Thread.java:818)

@yaseralimardany push notification did not support on a simulator.

Not working in 3.3.2. It does not call ids

Hi @hiteshagja can you confirm if your Xcode project is linking to react-native-onesignal correctly? It would look like this:

alt text

dude I really appreciate this.

Was this page helpful?
0 / 5 - 0 ratings