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?