Sending notifications to mobile devices using Firebase Admin SDK

Viewed 247

I am trying to send notifications to mobile devices using Firebase admin SDK with asp.net mvc, but I am stuck with a specific request limit.

Is there any way to get around this limit?

I have also tried to use the topic system, but it also has a limit.

I share some snippets of my code below.

    var path = HttpContext.Current.Server.MapPath("~/assd.json");
                    FirebaseApp.Create(new AppOptions()
                    {
                        Credential = GoogleCredential.FromFile(path),
                        ProjectId = "*********",
                    });
    
                    var message = new MulticastMessage
                    {
                        Data = new Dictionary<string, string>()
                             {
                                { "type", type },
                                { "typeValue", typeValue },
                                { "isSound", isSound.ToString()},
                                { "title", title},
                                { "body", spot },
    
                             },
                        Apns = new ApnsConfig()
                        {
                            Headers = new Dictionary<string, string>()
                        {
                            { "apns-priority", "10" },
                        },
                            Aps = new Aps()
                            {
                                Alert = new ApsAlert()
                                {
                                    Title = title,
                                    Body = spot,
                                },
                                Badge = 1,
                            },
                        },
                        Tokens = tokens,
                    };
    
                    var response =FirebaseMessaging.DefaultInstance.SendMulticastAsync(message).Result;
                    if (response.FailureCount > 0)
                    {
                        var failedTokens = new List<string>();
                        for (var i = 0; i < response.Responses.Count; i++)
                        {
                            if (!response.Responses[i].IsSuccess)
                            {
                                failedTokens.Add(tokens[i]);
                                listLog.Add(tokens[i]);
                            }
                        }
                    }
0 Answers
Related