本文介绍了IBM Worklight 6.1 - 推送通知中的平铺徽章从未在Windows Phone 8上清除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Worklight 6.1并向Windows Phone 8发送推送通知。除了磁贴徽章外,它正在运行。当我使用磁贴启动应用程序时,它不会被清除。我发送的通知是:

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}}}

弹出Toast消息,并且磁贴获取徽章,但是当我启动应用程序时徽章不会清除,我找到清除它的唯一方法是让服务器按下另一个通知:tile {count:0}

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?

推荐答案

更新:WL.Badge API仅限iOS。我已经提交了一个RFE来增强它或者创建专门的API来清除Windows Phone 8中的磁贴。

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

使用。

设置0应清除徽标中的徽章。

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

WL.Badge.setNumber(0);

您可以在处理收到的推送的同一逻辑中使用它(显示 Toast 弹出通知)。

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

除了设置或删除方法之外,Worklight不提供任何处理徽章的机制所以你需要写一个自己的。

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.

这篇关于IBM Worklight 6.1 - 推送通知中的平铺徽章从未在Windows Phone 8上清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 21:00