【问题标题】:How to send a tile push notification for WP8 from Azure notification hub and C# application?如何从 Azure 通知中心和 C# 应用程序发送 WP8 的磁贴推送通知?
【发布时间】:2014-10-07 03:35:04
【问题描述】:

我正在尝试使用具有 Azure 服务总线功能的 C# Winforms 应用程序向我的 WP8 应用程序发送磁贴通知。我已经使用所需的频道设置了应用程序,并且成功地能够向应用程序发送 toast 通知。但是,已证明磁贴通知更加困难。我一直在尝试使用 XML 以相同的方式发送它们,但我不确定为什么它在我的应用程序上不起作用。我的应用程序使用channel.BindToShellTile(); 以及其他通道逻辑,但我认为问题不存在,因为我能够通过同一个通道接收 toast。我目前正在尝试发送这个:

string tile = "<?xml version=\"1.0\"?>" +
            "<wp:Notification xmlns:wp=\"WPNotification\" Version=\"2.0\">" +
                "<wp:Tile Template=\"FlipTile\">" +
                    "<wp:BackgroundImage Action=\"Clear\">" + "red.png" + "</wp:BackgroundImage>" +
                    "<wp:Count Action=\"Clear\">" + "1" + "</wp:Count>" +
                    "<wp:Title Action=\"Clear\">" + "SENDPUSH" + "</wp:Title>" +
                    "<wp:BackBackgroundImage Action=\"Clear\">" + "blue.png" + "</wp:BackBackgroundImage>" +
                    "<wp:BackTitle Action=\"Clear\">" + "BackTitle" + "</wp:BackTitle>" +
                    "<wp:BackContent Action=\"Clear\">" + "Welcome Back!" + "</wp:BackContent>" +
                "</wp:Tile>" +
            "</wp:Notification>";

并使用以下方式发送:

hub.SendMpnsNativeNotificationAsync(tile);

任何帮助或指导将不胜感激。谢谢。

【问题讨论】:

标签: windows-phone-8 push-notification azure-notificationhub


【解决方案1】:

我找到了问题所在。我的 xml 显然是错误的,尽管我不确定问题的确切原因是什么。如果有人在苦苦挣扎,这里是工作 XML。

string tile = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<wp:Notification xmlns:wp=\"WPNotification\">" +
                    "<wp:Tile>" +
                      "<wp:BackgroundImage>" + backgroundImage + "</wp:BackgroundImage>" +
                      "<wp:Count>" + count + "</wp:Count>" +
                      "<wp:Title>" + Title + "</wp:Title>" +
                      "<wp:BackBackgroundImage>" + backBackgroundImg + "</wp:BackBackgroundImage>" +
                      "<wp:BackTitle>" + backTitle + "</wp:BackTitle>" +
                      "<wp:BackContent>" + backContent + "</wp:BackContent>" +
                   "</wp:Tile> " +
                "</wp:Notification>";

            hub.SendMpnsNativeNotificationAsync(tile);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-04-28
    • 2022-01-12
    • 2016-12-11
    • 2019-08-25
    • 2017-06-08
    • 1970-01-01
    • 2018-02-26
    相关资源
    最近更新 更多