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

C# FCM not getting delivered #310

Closed Deepankar1993 closed 2 years ago

Deepankar1993 commented 2 years ago

Hello, I am trying to send Push Notification using c# console app but its not delivering to the device However, the app is receiving the Notification sent from the Firebase consoles

Here is my Console App code

namespace FirebaseCloudMessaging.Example
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var defaultApp = FirebaseApp.Create(new AppOptions()
            {
                Credential = GoogleCredential.FromFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "key.json")),
            });
            Console.WriteLine(defaultApp.Name); // "[DEFAULT]"
            var message = new Message()
            {
                Data = new Dictionary<string, string>()
                {
                    ["FirstName"] = "John",
                    ["LastName"] = "Doe"
                },
                Notification = new Notification
                {
                    Title = "Message Title 1",
                    Body = "Message Body 1"
                },
                Topic = "adminalert"
            };
            var messaging = FirebaseMessaging.GetMessaging(defaultApp);
            //var result = await messaging.SendAsync(message).ConfigureAwait(false);
            var result = await messaging.SendAsync(message).ConfigureAwait(false);
            Console.WriteLine(result); //projects/myapp/messages/2492588335721724324
        }
    }
}
google-oss-bot commented 2 years ago

I found a few problems with this issue:

hiranya911 commented 2 years ago

Please report notification delivery issues directly at https://firebase.google.com/support. You can indicate your project ID and the message ID returned by the SDK when reporting the issue, and the FCM team can help you figure out what the problem is.