react-native-push-notification-CE icon indicating copy to clipboard operation
react-native-push-notification-CE copied to clipboard

[GCM] App crashes when receiving notification

Open nSimonFR opened this issue 6 years ago • 13 comments

After following the installation guide, I get this native error when receiving a Notification sent through FCM: com.google.firebase.iid.zzf cannot be cast to com.google.android.gms.iid.zzi

Package version: [email protected] compileSdkVersion: 26 buildToolsVersion: '26.0.2'

nSimonFR avatar May 18 '18 12:05 nSimonFR

Switching to FCM solved my problem. Also if it's of any use I managed to read something from the logs when it crashed: java.lang.ClassCastException: com.google.firebase.iid.zzf cannot be cast to com.google.android.gms.iid.zzi

nSimonFR avatar May 24 '18 10:05 nSimonFR

This is an issue with GCM I'll have to take a look at it but considering that GCM is deprecated as of 4/10/2018 and support will be removed on 4/10/2019.. I'm almost partial to removing GCM support..

Just thinking out loud

calcazar avatar May 25 '18 12:05 calcazar

I think you should leave this in till 4/10/2019.

There are still some businesses were change is hard and were it takes a long time. Sad but true. Did you find a way to fix this yet?

DiemasMichiels avatar Jun 20 '18 10:06 DiemasMichiels

Anyone using AWS's SNS on the back end is also stuck with GCM until Amazon adds support for FCM.

tony-bcl avatar Jul 02 '18 21:07 tony-bcl

We're in the same boat as @tony-krnl. @calcazar it would he helpful to at least know if anything is being done to remedy this issue.

mczarnocinski-adb avatar Jul 04 '18 09:07 mczarnocinski-adb

Here I agree with @calcazar if you need GCM support you have react-native-push-notification original library and seeing that if you migrate you push sender to FCM it works perfectly with old users that have the GCM version maybe the GCM support is not that important. I'm switching to firebase in my app and did this approach.

khrizt avatar Jul 04 '18 10:07 khrizt

The original library does not support push notifications for Android O+ which is only one of the many problems it has. So I do not think this is the best solution.

DiemasMichiels avatar Jul 04 '18 10:07 DiemasMichiels

That's true, but if you keep your targetSdkVersion to 25 push notifications in Oreo devices work correctly. I know it's a hack but meanwhile this is not solved or you migrate to Firebase can be a temporal solution.

khrizt avatar Jul 04 '18 11:07 khrizt

Apparently FCM is backwards compatible with GCM. Has anyone had any luck integrating with AWS SNS? fcm-with-aws-sns

ddemoll avatar Jul 05 '18 07:07 ddemoll

@nSimonFR when you say 'Switching to FCM solved my problem' what do you mean by that exactly? Switching on the API or on the client, and following what guide?

RobinJayaswal avatar Aug 09 '18 21:08 RobinJayaswal

I have also the same issue app crashes when push notification arrives and not displaying as well. I think it is problem with android oreo (8.1) Anyone have solution?

mayupat13 avatar Aug 10 '18 18:08 mayupat13

@RobinJayaswal I switched my client configuration to use FCM instead of GCM, following the README of the repo. I simply needed to activate the FCM API on Google Cloud Console, and there was plenty of guides that covered how to do that. There was no additional setup on the server as the APIs are practically the same (I'm using node-pushnotifications).

nSimonFR avatar Aug 12 '18 15:08 nSimonFR

@nSimonFR can you please add a link to the README? Not sure which repo are you referring to.

spotsadmin avatar Aug 23 '18 12:08 spotsadmin