/// <summary> /// Callback for handling notifications /// </summary> /// <param name="evt"></param> public static void UpdateNotifications(XdkNotificationPushEvent evt) { try { JsArray <JsString> myNotifications = Xdk.notification.GetNotificationList(); int len = myNotifications.length; for (int i = 0; i < len; i++) { //get the pushMobi message data XdkNotificationData msgObj = Xdk.notification.GetNotificationData(myNotifications[i]); //display the pushMobi message as a notification if there is no data if (msgObj.richHtml.ExactEquals(undefined) && msgObj.richUrl.ExactEquals(undefined)) { Xdk.notification.Alert(msgObj.msg, "pushMobi Message", "OK"); //remove the message from the server Xdk.notification.DeletePushNotifications(msgObj.id); } else { Xdk.notification.ShowRichPushViewer(msgObj.id, 10, 10, 10, 10, 80, 80); } } } catch (JsError e) { Alert("error in UpdateNotifications: " + e.message); } }
/* Callback for handling notifications */ public static void UpdateNotifications(XdkNotificationPushEvent evt) { try { JsArray <JsString> myNotifications = Xdk.notification.GetNotificationList(); int len = myNotifications.length; for (int i = 0; i < len; i++) { //get the pushMobi message data XdkNotificationData msgObj = Xdk.notification.GetNotificationData(myNotifications[i]); //display the pushMobi message as a notification if there is no data if (msgObj.isRich == false) { //Is this a simple text push message? //update the style of the t-shirt text if (msgObj.data != "") { HtmlElement.GetById("spnShirtMessage").style.cssText = msgObj.data; } console.Log(HtmlElement.GetById("spnShirtMessage").style.cssText); //print the message on the t-shirt HtmlElement.GetById("spnShirtMessage").innerHTML = msgObj.msg; Xdk.cache.SetCookie("tshirtMessage", msgObj.msg, -1); //message received Xdk.player.StartAudio("images/small-bell-ring-01.mp3"); HtmlElement.GetById("spnMessage").innerHTML = "Push Message Received"; //Hide the status message after 6 seconds ClearTimeout(msgTimeout); msgTimeout = SetTimeout("HideMessage();", 6000); //remove the message from the server otherwise the app will //think it has more messages waiting for it Xdk.notification.DeletePushNotifications(msgObj.id); } else { //show rich push messages in the rich viewer Xdk.notification.ShowRichPushViewer(msgObj.id, 10, 10, 10, 10, 80, 80); break; // only one rich message at a time, will resume after RichViewerClosed } } } catch (JsError e) { Alert("error in UpdateNotifications: " + e.message); } }