Skip to main content

Posts

Showing posts from September, 2017

send push notification from C# using FCM

        public bool SendPushNotification(string deviceId, string message)         {      //applicationID = "AIzaSyxxxxxxxxxxxxxxxxxxx"     // senderId = "98xxxxxxxxx"             bool isSent = false;             string str = "";             try             {                 WebRequest tRequest = WebRequest.Create("https://fcm.googleapis.com/fcm/send");                 tRequest.Method = "post";                 tRequest.ContentType = "application/json";                 var data = new                 {                     to = deviceId,                     notification = new                     {                         body = message,                         title = "SpAlert",                         sound = "Enabled"                     }                 };                 var serializer = new JavaScriptSerializer();                 var json = serializer.Serialize(data);