calcazar / react-native-push-notification-CE

The community edition of the push notification library (by Zo0r) for applications made with React Native
MIT License
52 stars 23 forks source link

[GCM] App crashes when receiving notification #6

Open nSimonFR opened 6 years ago

nSimonFR commented 6 years ago

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: react-native-push-notification-ce@3.1.7 compileSdkVersion: 26 buildToolsVersion: '26.0.2'

nSimonFR commented 6 years ago

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

calcazar commented 6 years ago

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

DiemasMichiels commented 6 years ago

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?

ghost commented 6 years ago

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

mczarnocinski-adb commented 6 years ago

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.

khrizt commented 6 years ago

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.

DiemasMichiels commented 6 years ago

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.

khrizt commented 6 years ago

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.

ddemoll commented 5 years ago

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

RobinJayaswal commented 5 years ago

@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?

mayupat13 commented 5 years ago

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?

nSimonFR commented 5 years ago

@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).

spotsadmin commented 5 years ago

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