DEV Community

the king gamer
the king gamer

Posted on

Request of help firebase

This is the dll I created to send notification.
I really don't understand why it continue to send nothing, in the program there aren't errors.
can someone please give me an help, thanks.

using CorePush.Firebase;
using System.Net.Http;
using Plugin.Firebase.CloudMessaging;


namespace Documentation
{

    public partial class Avvio
    {



        private readonly HttpClient httpClient;

        public Avvio()
        {
            this.httpClient = new HttpClient();
        }





        public async Task InviaNotificaAsync()
        {
            var firebaseSettingsJson = await File.ReadAllTextAsync("myfile.json");
            var fcm = new FirebaseSender(firebaseSettingsJson, httpClient);



            string payload = @"
            {
              ""message"": {
                ""topic"": ""all"",
                ""notification"": {
                  ""title"": ""Match update"",
                  ""body"": ""Arsenal goal in added time, score is now 3-0""
                },
                ""android"": {
                  ""ttl"": ""86400s"",
                  ""notification"": {
                    ""click_action"": ""OPEN_ACTIVITY_1""
                  }
                },
                ""apns"": {
                  ""headers"": {
                    ""apns-priority"": ""5""
                  },
                  ""payload"": {
                    ""aps"": {
                      ""category"": ""NEW_MESSAGE_CATEGORY""
                    }
                  }
                },
                ""webpush"": {
                  ""headers"": {
                    ""TTL"": ""86400""
                  }
                }
              }
            }";



            await fcm.SendAsync(payload);


        }
    }
}

Enter fullscreen mode Exit fullscreen mode

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more