问题
I'm using Worklight 6.1 and sending push notifications to Windows Phone 8 using unauthenticated procedure.
I am creating the notification by using the following procedure. This procedure updates the tile and badge but doesn't generates a toast notification:WL.Server.createDefaultNotification(notificationText, badgeDigit, {custom:"data"});
- What is the correct procedure for adding a "toast" to a received push notification on Windows Phone 8?
- Also, is there any way to clear the notification on the tile once the application is launched by clicking it?
回答1:
The WL.Server.createDefaultNotiication API method returns only the
rawandtilenotification types for Windows Phone 8. To add atoastnotification, see the example below.var notification = WL.Server.createDefaultNotification("You have " + numCoupons + " coupons.", numCoupons, {foo: "bar"}); notification.MPNS.toast = {}; notification.MPNS.toast.text1 = "Toast title”; notification.MPNS.toast.text2 = "Toast content”;To clear the number from the application icon, or tile, the
WL.Badgemethod should be used. However, in Worklight 6.1 this method is applicable only for the iOS environment (see also this question for a possible alternative).Starting Worklight 6.2, WL.Badge is applicable for Windows Phone 8 as well.
来源:https://stackoverflow.com/questions/26583133/toast-for-push-notification-on-windows-phone-8-using-worklight-6-1