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

IOS Notifications do not receive on background

Open mcmatan opened this issue 9 years ago • 15 comments

First, this for this beautiful repo!

Now I'm went through all the steps, and for Local notifications It does work really well. But when app is in background, there is no notifications.

Yes I've added " "content_available": true"

So when I'm sending:


let body = {
            "to": token,
            "content_available": true,
            "notification": {
                "title": "hello",
                "body": "yo",
                "click_action": "fcm.ACTION.HELLO",
            },
            "data": {
                "extra":"juice",
            }
        };



Registering:

FCM.requestPermissions(); // for iOS
        FCM.getFCMToken().then(token => {
            console.log(token);
            self._setToken(token);
        });

And I'm using v5.0.

When I checked, I noticed in Xcode that this methods:

didReceiveNotificationResponse didReceiveRemoteNotification

Are never called!

Do I need to add the p12 file to somewhere in firebase? What I'm I missing?

Thanks

mcmatan avatar Jan 31 '17 00:01 mcmatan

you need to add p12 in firebase console, but you don't need to include in source code what is the endpoint response when you send the payload to fcm? Are you using iphone rather than emulator?

evollu avatar Jan 31 '17 14:01 evollu

@evollu adding the p12 to firebase did the trick! I didnt find it and there is no mention for this in the documentary. Thank you so much for you quick response and for this repo,

Closing issue.

mcmatan avatar Jan 31 '17 16:01 mcmatan

I am also not receiving push notifications when app in background. however when app in foreground and opened I can read the the incoming message. What exactly is the p12?

jasan-s avatar Jun 10 '17 11:06 jasan-s

https://firebase.google.com/docs/cloud-messaging/ios/certs

evollu avatar Jun 10 '17 11:06 evollu

@evollu , oh I choose the APN key and uploaded that to firebase. Yet still no banner for notification in background. I even set the FirebaseAppDelegateProxyEnabled to No in info.plist.

jasan-s avatar Jun 10 '17 11:06 jasan-s

you should leave FirebaseAppDelegateProxyEnabled as Yes. did you add permissions in xcode?

evollu avatar Jun 10 '17 11:06 evollu

Sweet thanks @evollu I had to set the FirebaseAppDelegateProxyEnabled as Yes. that was it.

jasan-s avatar Jun 10 '17 11:06 jasan-s

My notification listener isn't getting anything when sending message through firebase console.

@evollu is the p12 required when running an emulator?

leu2tm avatar Jun 15 '17 14:06 leu2tm

@leu2tm emulator can't receive remote notif

evollu avatar Jun 15 '17 15:06 evollu

Ok thanks for the quick clarification @evollu !

But shouldn't the log display that remote notification won't work then? I don't get anything at all..

leu2tm avatar Jun 16 '17 07:06 leu2tm

Can you please put FirebaseAppDelegateProxyEnabled in Docs if i haven't found about it here I would be still losing my mind. @evollu Thank you alot for this repo and for helping us solve our problems

M3po avatar Jul 03 '17 12:07 M3po

@leu2tm nope it won't. It is iOS limitation not Firebase

evollu avatar Jul 03 '17 12:07 evollu

@M3po FirebaseAppDelegateProxyEnabled is documented on Firebase website and I suggest leaving it default. What should I put in Docs?

evollu avatar Jul 03 '17 12:07 evollu

@evollu Than my bad as i didn't found it there. I meant for you to put it as notice if people can't seem to get it working on ios (nothing more), but if it is there then no need. Again thank you for all your work and help.

M3po avatar Jul 03 '17 12:07 M3po

anyone can point FirebaseProxyEnabled option in xcode

nzrsrk avatar Sep 24 '18 07:09 nzrsrk