firebase / firebase-admin-dotnet

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

Send in legacy format #338

Closed WeUseBc closed 1 year ago

WeUseBc commented 1 year ago

I'm using the c# version 2.2.0 and I need to send a message in the legacy format:

{
    "to": "/topics/topics_",
    "notification": {
        "body": "...",
        "title": "..."
    },
    "data":{
     ...
    },
    "content_available": true
}

Specifically, I need the "content_available": true for our apps to understand the message correctly. However, when using FirebaseAdmin.Messaging.Message() I don't have the possibility of setting this field, the only way is to do:

                    Apns = new ApnsConfig{
                        Aps = new Aps{
                            ContentAvailable = true
                        }
                    },

However, this doesn't work with the setup as it requires the legacy version. Is there any way that I can use the legacy version of a message? Or is it possible to change how the message is encoded into json?

google-oss-bot commented 1 year ago

I found a few problems with this issue: