Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending a Notification with the notification object as null does not send a Notification to the device #379

Open
wynston-champion-actabl opened this issue Nov 25, 2024 · 0 comments

Comments

@wynston-champion-actabl
Copy link

wynston-champion-actabl commented Nov 25, 2024

When sending a notification (via a server) and setting the notification object to null, the notification is not sent to the device, though, I do get a 200 response (confirmed when tested in Postman). The reason why I am wanting to set this object to null is to keep the server code to be cross compatible between my Xamarin Forms and MAUI app.

For Xamarin Forms, I am using a different library (Plugin.FirebasePushNotification), but I am able to set the notification object to null and the notification sends to the device. I'd like to not have to manage two ways of sending notifications for Xamarin Forms and MAUI and allow the code to be cross compatible.

Would it at all be possible to allow the notification object to be null?

Here is the payload for MAUI that sends a successful notification:

{
    "message":{
      "token":"_some_token_",
      "notification":{
        "body":"This is an FCM notification message!",
        "title":"FCM Message"
      },
      "data": {
        "actualData": "_some_serialized_data_"
        },
        "apns": {
            "fcmOptions": null,
            "headers": {
                "apns-priority": "5"
            },
            "payload": {
                "aps": {
                    "content-available": 1
                }
            }
        }
    }
}

Here is the payload for MAUI that is unsuccessful:

{
    "message":{
      "token":"_some_token_",
      "notification":null,
      "data": {
        "actualData": "_some_serialized_data_"
        },
        "apns": {
            "fcmOptions": null,
            "headers": {
                "apns-priority": "5"
            },
            "payload": {
                "aps": {
                    "content-available": 1
                }
            }
        }
    }
}

Notice that the notification object, when set to null, does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant