Closed quocman1982 closed 4 years ago
I don't know guys, it sound really weird but this solved my problem: I changed "react-native-push-notification": "^3.1.9" to "react-native-push-notification": "3.1.9" by doing: yarn add react-native-push-notification@3.1.9
I don't know where the "^" came from or why it's causing problems but I'm so happy that it's solved. Hopefully it will help some of you.
Hi @metinvio Do not use this solution, the library in this version as too many bugs. Please paste your AndroidManifest, there is probably extra data not needed such as GCM.
Hi @Dallas62
this is my manifest, but when I remove GcmReceiver, other devices wont receive push notifications. And when I leave it my device crashes when receiving push.
<meta-data
android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@android:color/white"/>
<!-- < Only if you're using GCM or localNotificationScheduhale() > -->
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<!-- < Only if you're using GCM or localNotificationSchedule() > -->
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService"/>
<!-- < Only if you're using GCM or localNotificationSchedule() > -->
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<!-- </ Only if you're using GCM or localNotificationSchedule() > -->
Yes this is normal, you have to change your AndroidManifest to this: https://github.com/zo0r/react-native-push-notification#android-manual-installation
<meta-data
android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@android:color/white"/>
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
@Dallas62 Yes now it doesn't crash anymore and I receive push-notifications in debug and release. But my customer doesn't receive any. Do you think it is caused by Android API Level or his device configs?
I think this is related to the default channel_id of firebase which is not set. Take a look to recent issues about “popup”. Like #1495 and #1479
Everything working until it receive an notification
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.seller, PID: 15468 java.lang.ClassCastException: com.google.android.gms.iid.zzi cannot be cast to com.google.firebase.iid.zzf at com.google.firebase.iid.zzh.onServiceConnected(Unknown Source:4) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1730) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1762) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.seller">
Can you help me ?