I'm using PushSharp version 4.0.1 and currently when ever I send out a notification the title displays fine but the body of the message always displays as ''. If I send a test message directly to GCM from Postman with out using PushSharp the content displays fine. Below is how I'm structuring the message body. Any ideas would be great!
gcmBroker.QueueNotification(new GcmNotification
{
RegistrationIds = new List<string>
{
token
},
Data = JObject.Parse("{ \"title\" : \""+ message.PatientFirstName +" "+ message.PatientLastName + ". " + message.GlucoseMeasurement.TrendArrow +"\"," +
" \"body\" : \""+ message.GlucoseMeasurement.ValueInMgPerDl + "at" + message.GlucoseMeasurement.Timestamp + "\"," +
" \"icon\" : \"icon\"," +
" \"color\" : \"#FF4081\"}")
});
Actually ended up figuring it out after digging further into the GCM docs. I was trying to send a data notification unknowingly since I was using the Data
param. The code should have looked like this instead...
gcmBroker.QueueNotification(new GcmNotification
{
RegistrationIds = new List<string>
{
token
},
Notification = JObject.Parse("{ \"title\" : \"" + message.PatientFirstName + " " + message.PatientLastName + ". " + message.GlucoseMeasurement.TrendArrow + "\"," +
" \"body\" : \"" + message.GlucoseMeasurement.ValueInMgPerDl + " at " + message.GlucoseMeasurement.Timestamp + "\"," +
" \"icon\" : \"icon\"," +
" \"color\" : \"#FF4081\"}")
});