Windows电话推送通知中的操作=“清除”

时间:2013-12-18 12:58:04

标签: windows-phone-8 push-notification mpns

在向WP通知服务器发送XML时,我不太了解Action =“Clear”的目标。

示例:

<?xml version="1.0" encoding="utf-8"?>
<wp:Notification xmlns:wp="WPNotification" Version="2.0">
  <wp:Tile Id="[Tile ID]" Template="IconicTile">
    <wp:SmallIconImage [Action="Clear"]>[small Tile size URI]</wp:SmallIconImage>
    <wp:IconImage Action="Clear">[medium/wide Tile size URI]</wp:IconImage>
    <wp:WideContent1 Action="Clear">[1st row of content]</wp:WideContent1>
    <wp:WideContent2 Action="Clear">[2nd row of content]</wp:WideContent2>
    <wp:WideContent3 Action="Clear">[3rd row of content]</wp:WideContent3>
    <wp:Count Action="Clear">[count]</wp:Count>
    <wp:Title Action="Clear">[title]</wp:Title>
    <wp:BackgroundColor Action="Clear">[hex ARGB format color]</wp:BackgroundColor>
  </wp:Tile>
</wp:Notification>

我想用一个简单的标题和一个图像每天推送设备一次,所以我应该在每个属性上放置Action =“Clear”吗?

如果不把它怎么办?

1 个答案:

答案 0 :(得分:1)

您不需要使用Action="Clear",除非其名称表明您需要清除属性的值。

基本上,当您从通知中省略值时,它会保留旧值。例如,如果您决定从图块中删除计数并发送:

<wp:Count></wp:Count>

然后它实际上不会删除计数但保留旧值。这很方便,因为这意味着您只需要在通知中发送要更新的值。当你想要的是真正清除属性而不保留以前的值时,你只需要添加Action="Clear"部分:

<wp:Count Action="Clear"></wp:Count>