[c++] FCM on iOS 10 messes with the local notifications?

234 views
Skip to first unread message

Fedor Chegarovskiy

unread,
Apr 25, 2017, 9:35:02 AM4/25/17
to Firebase Google Group
Initially I thought that messaging::Listener works only with the remote notifications, or even Firebase-only notifications (In case I have other push notifications framework integrated).

But it turned out that Firebase intercepts the local notifications as well, and this is confusing.

First, because some parts of my code rely on and work with the local notifications and should not be interacting with Firebase in any way (for multiple reasons), but local notifications intercepted by Firebase never get in didReceiveLocalNotification method of AppDelegate;

Second, because when messaging::Listener::OnMessage fires - it's Message::data field contains only one key/value pair. for some reason, while I put multiple entries in the userInfo of UILocalNotification, so I'm basically losing the payload (I do still hope there is a bug somewhere on my side and not in Firebase).

I'm using the deprecated local notifications API for now, I will test with the new one a bit later.

Stewart Miles

unread,
May 10, 2017, 5:02:53 PM5/10/17
to Firebase Google Group, Rizwan Sattar
Hi Fedor,

From Rizwan (cc'd):

"
The main thing that comes to mind is that UILocalNotification is deprecated, and on iOS 10, if the UNUserNotificationCenter delegate is set, via [UNUserNotificationCenter currentCenter].delegate = ...

If that delegate is set, then the application:didReceiveLocalNotification: will not be called. This is because UNUserNotificationCenter consolidates local and remote notifications, and so the expected call  for the local notifications is the same: userNotificationCenter:willPresentNotification:withCompletionHandler:

If you're setting UNUserNotificationCenter delegate that would explain why you're not seeing application:didReceiveLocalNotification: called.
"

Also, did you see we just released 3.1.1 with a few bug fixes that you may want to check out https://firebase.google.com/support/release-notes/cpp-relnotes#3.1.1

Cheers,
Stewart

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/f8cbbe74-dcfe-4511-bbd1-cc677ac722bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fedor Chegarovskiy

unread,
May 25, 2017, 10:02:56 AM5/25/17
to Firebase Google Group, rsa...@google.com
Hi!

Yes, and this situation is what bothers me: firebase::messaging::Initialize leads to UNUserNotificationCenterDelegate being set by Firebase SDK, and since now it consolidates both local and remote notifications - Firebase SDK starts to receive local notifications, and it pretty much falls under "interception", because there can be only one delegate, so the programmer can't set his own after that point (well, he can, but then it will cripple Firebase SDK, since it will no longer be able to receive it's push notifications).

I tested this briefly and this is what I get:

Situation A:
1) I call firebase::messaging::Initialize
2) I set my own UNUserNotificationCenter.delegate
3) My delegate receives all notifications (both local and remote) and Firebase SDK receives nothing, since it's delegate is now dangling, and, it's important: there is no way that I know of to pass a remote notification to the Firebase SDK in case I have received it in my own delegate

Situation B:
1) I call firebase::messaging::Initialize
2) I do not set my UNUserNotificationCenter.delegate
3) Firebase SDK gets all notifications

Both cases are bad, and the only solution I can think of is making a way to pass notifications from the user delegate to the Firebase SDK, instead of having Firebase's own delegate;

Stewart Miles

unread,
Jun 9, 2017, 7:18:34 PM6/9/17
to Firebase Google Group
Hi Fedor,

We resolved this issue in version 4.0.0 of our SDK.

Basically you need to grab the delegate we install on the location notification center and call it from your own delegate if you install a delegate after initializing Firebase messaging.

If you setup your delegate before Firebase messaging we'll call your delegate when we receive notifications.  All FCM notifications are routed from the notification center hence the need to do this.

Release notes are here:

Cheers,
Stewart

On Tue, Apr 25, 2017 at 1:55 AM, Fedor Chegarovskiy <jph...@gmail.com> wrote:

--

Fedor Chegarovskiy

unread,
Jun 19, 2017, 10:52:13 AM6/19/17
to Firebase Google Group
Hi! I'm glad to hear that, will update my project asap.


On Saturday, June 10, 2017 at 2:18:34 AM UTC+3, Stewart Miles wrote:
Hi Fedor,

We resolved this issue in version 4.0.0 of our SDK.

Basically you need to grab the delegate we install on the location notification center and call it from your own delegate if you install a delegate after initializing Firebase messaging.

If you setup your delegate before Firebase messaging we'll call your delegate when we receive notifications.  All FCM notifications are routed from the notification center hence the need to do this.

Release notes are here:

Cheers,
Stewart
On Tue, Apr 25, 2017 at 1:55 AM, Fedor Chegarovskiy <jph...@gmail.com> wrote:
Initially I thought that messaging::Listener works only with the remote notifications, or even Firebase-only notifications (In case I have other push notifications framework integrated).

But it turned out that Firebase intercepts the local notifications as well, and this is confusing.

First, because some parts of my code rely on and work with the local notifications and should not be interacting with Firebase in any way (for multiple reasons), but local notifications intercepted by Firebase never get in didReceiveLocalNotification method of AppDelegate;

Second, because when messaging::Listener::OnMessage fires - it's Message::data field contains only one key/value pair. for some reason, while I put multiple entries in the userInfo of UILocalNotification, so I'm basically losing the payload (I do still hope there is a bug somewhere on my side and not in Firebase).

I'm using the deprecated local notifications API for now, I will test with the new one a bit later.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages