react-native-onesignal icon indicating copy to clipboard operation
react-native-onesignal copied to clipboard

ids event does not fire on app load

Open hiteshagja opened this issue 8 years ago • 14 comments

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.

hiteshagja avatar May 13 '18 12:05 hiteshagja

same problem

yaseralimardany avatar May 14 '18 04:05 yaseralimardany

Same problem

rafaelribeiros avatar May 14 '18 13:05 rafaelribeiros

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

alt text

Nightsd01 avatar May 14 '18 19:05 Nightsd01

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

bhgames avatar May 14 '18 21:05 bhgames

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

hiteshagja avatar May 14 '18 22:05 hiteshagja

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.

Nightsd01 avatar May 14 '18 22:05 Nightsd01

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

On Mon, May 14, 2018 at 6:14 PM, Brad Hesse [email protected] 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.

bhgames avatar May 15 '18 00:05 bhgames

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

yaseralimardany avatar May 15 '18 03:05 yaseralimardany

@Nightsd01

Thank you.

hiteshagja avatar May 15 '18 05:05 hiteshagja

I'm experiencing the same issue on Android in 3.2.3

bighitbiker3 avatar May 18 '18 23:05 bighitbiker3

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 avatar May 19 '18 04:05 yaseralimardany

@yaseralimardany push notification did not support on a simulator.

kraisorns avatar Jul 11 '18 11:07 kraisorns

Not working in 3.3.2. It does not call ids

developerashish01 avatar Aug 16 '19 08:08 developerashish01

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.

omerersoyy avatar Jan 15 '20 12:01 omerersoyy