none
FireBased pushnotification fcmClient.SendAsync(message,cancellationToken) returning null RRS feed

  • Question

  • For the IOS push notifications I am using below code and running from c#.net windows servervice

          var settings = FileBasedFcmClientSettings.CreateFromFile("c:\\fcm.json");
                // Construct the Client:
                using (var client = new FcmClient(settings))
                {
                    var notification = new Notification
                    {
                        Title = "message_tobeSent",
                        Body = "message_tobeSent",//change later
                    }  
                    // The Message should be sent to the News Topic:
                    var message = new FcmMessage()
                    {
                        ValidateOnly = false,
                        Message = new Message
                        {
                            Notification = notification,
                            Token = token //dynamic value
                        }
                    };
                    // Finally send the Message and wait for the Result:
                    CancellationTokenSource cts = new CancellationTokenSource();
                    // Send the Message and wait synchronously:
                    var result = client.SendAsync(message, cts.Token).Result;

    From the above code following line of code returning the null value

    "client.SendAsync(message, cts.Token)"

    If I run the same code from console app its working.

    Please suggest me, what i am missing?

    • Moved by CoolDadTx Thursday, March 21, 2019 1:50 PM Third party product
    Wednesday, March 20, 2019 6:41 PM

All replies

  • Hi Naveen Gade,

    According to your description and relevance code, I am not what is FcmClient, is it a class in 3rd-party library, if so, I would suggest that you could post on 3rd-party forum for suitable support.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 21, 2019 6:12 AM