Data messages broken with the new Firebase update

pelisterpelister USMember ✭✭

I upgraded Firebase packages to 2.0.0 yesterday. There are some API changes that are currently not reflected to the documentation here.

As per the compiler errors and warnings, I replaced InstanceId.Notifications.ObserveTokenRefresh(this.OnTokenRefresh) with the new delegate method called DidRefreshRegistrationToken. There are no prblems with getting a Firebase token.

I also replaced Messaging.SharedInstance.Connect(this.OnConnected) with Messaging.SharedInstance.ShouldEstablishDirectChannel = true. And now data messages are broken, the app cannot receive any, ApplicationReceivedRemoteMessage is never called.

Can the Xamarin guys provide a documentation following such updates?


  • pelisterpelister USMember ✭✭

    I'm sorry I didn't mention that the data message problem is on iOS 11 only.

    Has anyone tried FCM on iOS11 yet? what are your results?

  • KimJensenKimJensen USMember ✭✭

    I got the latest release and I now get those error:

    IMessagingDelegate 'AppDelegate' does not implement interface member 'ImessagingDelegate.DidRefreshRegistrationToken(Messing,string)'

    Messaging.SharedInstance.RemoteMessageDelegate = this;
    Messaging.RemoteMessageDelegate is obsolete: Use Delegate property instead'

    'App' does not exist in namespace 'Firebase.Analytics'

    Have the same code and the same Xamarin.Firebase.Messaging NuGet package on the Mac with no errors.

    You changed InstanceId.Notifications.ObserveTokenRefresh ((sender, e) to DidRefreshRegistrationToken
    How did you replace it because I can't find DidRefreshRegistrationToken?

  • KimJensenKimJensen USMember ✭✭

    I found that the Firebase.Analytics.App.Configure(); is now Firebase.Core.App.Configure();

  • pelisterpelister USMember ✭✭

    Hi Kim,
    I made all of my changes following the compiler warnings and errors. The compiler warns that InstanceId.Notifications.ObserveTokenRefresh was obsolete and that the new delegate method should be used.

    After such a breaking change, xamarin still has not updated the official documentation as of today.

  • KimJensenKimJensen USMember ✭✭

    I was able to change all but this one.
    IMessagingDelegate 'AppDelegate' does not implement interface member 'ImessagingDelegate.DidRefreshRegistrationToken(Messing,string)'

    Right now my code looks like this:
    InstanceId.Notifications.ObserveTokenRefresh ((sender, e)=>

  • pelisterpelister USMember ✭✭

    Actually just add the method with the correct signature, and you should be good to go:

    public void DidRefreshRegistrationToken(Messaging, string)

    I wish you can receive data messages.

  • JannieTheunissenJannieTheunissen GBMember ✭✭
    edited October 20

    I can receive data messages on on this undocumented method:

    public void DidReceiveMessage(Firebase.CloudMessaging.Messaging messaging, Firebase.CloudMessaging.RemoteMessage remoteMessage)

    @pelister Can you please help me with the exact method that you called?

    Did you removed the "InstanceId.Notifications.ObserveTokenRefresh" and do you have to call the DidRefreshRegistrationToken from FinishedLaunching method?

  • pelisterpelister USMember ✭✭

    @ASHISHKUMAR.8068 yes I removed InstanceId.Notifications.ObserveTokenRefresh.
    DidRefreshRegistrationToken is actually a method from IMessagingDelegate interface, you can't invoke it by yourself. you
    should implement the interface.

    edited November 14

    @pelister Can you share your piece of code , because my debugger never hits DidRefreshRegistrationToken.This is what I have done.

    public void DidRefreshRegistrationToken(Messaging mess, string token)
    and I am using "Xamarin.Firebase.iOS.CloudMessaging" version="2.0.4"


    @pelister The link is for AppDelegate

Sign In or Register to comment.