firebase / firebase-admin-dotnet

Firebase Admin .NET SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
357 stars 129 forks source link

Setting "CollapseKey" not works as expected #344

Closed hgndgn closed 1 year ago

hgndgn commented 1 year ago

[READ] Step 1: Are you in the right place?

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

I have react-native app, where I am using firebase to get push notifications.

Using C# Admin SDK I am sending a push notification with a CollapseKey to my device. When I print the remote message in my BackgroundMessageHandler the collapse key is always com.myapp, despite I am setting it in the message. Should I do something else?

Below is the message object that I am sending.

Steps to reproduce:

What happened? How can we make the problem occur? This could be a description, log/console output, etc.

Relevant Code:

new Message()
{
    Token = payload.PushToken,
    Data = payload.Data,
    Android = new AndroidConfig()
    {
        Notification = new AndroidNotification()
        {
            Title = payload.Notification.Title,
            Body = payload.Notification.Body,
        },
        Data = payload.Data,
        Priority = Priority.High,
        CollapseKey = "my-collapse-key"
    }
};
google-oss-bot commented 1 year ago

I found a few problems with this issue:

chong-shao commented 1 year ago

Hello, this is working as intended. According to the public documentation https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages, "Notification messages are always collapsible and will ignore the collapse_key parameter."