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

Top comments (0)