question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No event on data only firebase message

See original GitHub issue

Hi

I am trying to send a data message but event is not triggered. I am using FirebaseNet nuget package as shown in the docs.

When i do : ` FCMClient client = new FCMClient(serverKey);

        var message = new Message()
        {
            Data = data,
        };

        message.RegistrationIds = registrationIds;

        var result = await client.SendMessageAsync(message);
        DownstreamMessageResponse specificResult = (DownstreamMessageResponse)result;`

No events, and a success response from firebase.

When i add the Notification section i do get the event with the data, but i also get the notification ofcourse.

` FCMClient client = new FCMClient(serverKey);

        var message = new Message()
        {
            Data = data,
            Notification = new AndroidNotification()
            {
                Body = body,
                Title = title,
            }
        };

        message.RegistrationIds = registrationIds;

        var result = await client.SendMessageAsync(message);
        DownstreamMessageResponse specificResult = (DownstreamMessageResponse)result;`

I have attached to the handler in Android

` //Handle notification when app is closed here CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) => {

        };`

And the one in App.cs

` private void Current_OnNotificationReceived(object source, FirebasePushNotificationDataEventArgs e) {

    }`

Neither one of them trigger with the data only. Any idea’s ?

Thanks!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
christophedemeycommented, Oct 5, 2017

Hi @rdelrosario

Thanks again for the help!

0reactions
rdelrosariocommented, Oct 5, 2017

This handler is just fired when receives the notification immediately if you are using data messages. I will recommend not to use notification message and always send it as data message.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase Messaging Not Sending Data-Only Notification
I am using Firebase Messaging to send notifications. The goal is to receive the data packet, format it (pulling local info in as...
Read more >
Understanding message delivery | Firebase Cloud ... - Google
Received (available only on Android devices) — The data message or notification message has been received by the app. This data is available...
Read more >
About FCM messages | Firebase Cloud Messaging - Google
Firebase Cloud Messaging (FCM) offers a broad range of messaging options and ... Data messages have only custom key-value pairs with no reserved...
Read more >
Cloud Messaging
When an incoming message is "data-only" (contains no notification option), both Android & iOS regard it as low priority and will prevent the...
Read more >
Cloud Messaging
The Cloud Messaging package connects applications to the Firebase Cloud Messaging (FCM) service. You can send message payloads directly to devices at no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found