c# - PushSharp “get json on NotificationSent ” issue -


i used pushsharp ddl, trying save status of notification send in database. on notficationsent event, update database status=true notificationid=xxxx notficationsent event includes json pushed in parameter (notification)

i try json in sentnotification event know notificationid wrote code did not work.

static void notificationsent(object sender, inotification notification)     { var push = (pushsharp.android.gcmnotification)notification;     json =newtonsoft.json.jsonconvert.deserializeobject<dynamic(push.jsondata);     var notificationid=json.notificationid     } 

the code not completed run stopped @ line no error , function exit, can not notificationid in variable

json =newtonsoft.json.jsonconvert.deserializeobject<dynamic(push.jsondata); 

inotification interface , jsondata property not part of interface. parameter instance passed in may not in fact gcmnotification type, should check ensure , case it:

static void notificationsent(object sender, inotification notification) {   var gcmnotification = notification gcmnotification;   if (gcmnotification != null) {     var json = jobject.parse (gcmnotification.jsondata);     var notificationid = json["notificationid"].tostring ();   } } 

Comments