Hitesh Riziya Hitesh Riziya - 21 days ago 9
C# Question

PushSharp:Android GCM Push Notification received without push message

I am using PushSharp library to send push notification from my application.

PushService push = new PushService();
var reg_id_d = "APA91bETd-LsqnZjA-HKrnBOY3FbEhmWchpiwuhRkiv4gUdGDuvwDRB7YURICZ131XppDAUNUBLGe_vEPkQ-JR8UaVX7Y-NCkEfastCBLIYcUoFtt5cPafeKXHywi0WGDYW33ZQqr3oy";
var project_id_d = "482885626272";
var api_key_d = "AIzaSyAbh7R5KQR3KM7W_y-yS-Ao-JNiihNz7tE"; // "AIzaSyDcKfuW77GTwA46L6sqD41YhGf2j5S8o2w";
var package_name_d = "com.get.deviceid";

push.StartGoogleCloudMessagingPushService(new GcmPushChannelSettings(project_id_d, api_key_d, package_name_d));
push.QueueNotification(NotificationFactory.AndroidGcm()
.ForDeviceRegistrationId(reg_id_d)
.WithCollapseKey("NONE")
.WithJson("{\"alert\":\"Alert Text!\",\"badge\":\"1\"}"));


I am getting notification on my device but with blank message..

I have tried with sever code available in C# to send GCM push notification, but getting same problem of having blank message.

I tried using PHP to send notification. and it is working as expected. so, I am not sure what is wrong in my above code. Can anyone please help me on this?

Answer

I tried using different code available around.. but none of those were working..

finally I tried http://stackoverflow.com/a/11651066/1005741 and it works like a charm!