1
votes

I'm using Worklight 6.1 and sending push notifications to Windows Phone 8. It is working swell, except for the tile badge. It is not being cleared when I use the tile to launch the app. The notification that I'm sending is:

{"APNS":{ … },"GCM":{ … },"SMS":{ … },"MPNS":{"raw":{"payload":{}},"toast":{"text1":"Luggage Tracker","text2":"You have 3 available messages"},"tile":{"count":3}}}

The toast message pops up, and the tile gets the badge, but the badge doesn't clear when I launch the app, and the only way I can find to clear it is to have the server push another notification with: tile {count:0}

Is there any way for the app to clear the tile badge?

1

1 Answers

0
votes

Update: the WL.Badge API is iOS-only. I have submitted an RFE to either enhance it or create specialized API for clearing the tile in Windows Phone 8 as well.

So the solution at this time, as I see it, is to create a Cordova plug-in to update the count... I found this plug-in. Perhaps you take from it when you need: https://github.com/sgrebnov/incubator-cordova-wp8/blob/master/plugins/www/plugins/LiveTiles/liveTilesExample.html


Use the WL.Badge.setNumber() API method.
Setting 0 should clear the badge from the tile.

WL.Badge.setNumber(0);

You can probably use this in the same logic that handles the received push (the one that shows the Toast pop up notification).

Worklight does not provide any mechanism to handle the badges other than methods to set or remove so you need to write one of your own.