【问题标题】:Windows Phone Tile push notification does not receive?没有收到 Windows Phone Tile 推送通知?
【发布时间】:2013-10-01 09:39:39
【问题描述】:

您好,我正在为 Windows Phone 8 进行开发。我需要使用 PHP 发送和接收磁贴推送通知。我的设备没有收到磁贴推送通知。我收到下面给出的错误。谁能告诉我为什么我会遇到这个问题?

错误:

HTTP/1.1 200 OK Cache-Control: private 服务器: Microsoft-IIS/7.5 X-DeviceConnectionStatus: Connected X-NotificationStatus: Suppressed X-SubscriptionStatus: Active X-MessageID: 00000000-0000-0000-0000-000000000000 ActivityId: d4a926a3-345c-432f-9a96-2f9c62ce8013 X-Server:DB3MPNSM036 X-AspNet-Version:4.0.30319 X-Powered-By:ASP.NET 日期:2013 年 10 月 1 日星期二 09:08:33 GMT 内容长度:0

我正在使用下面给出的代码:

 HttpNotificationChannel pushChannel;

        // The name of our push channel.
        string channelName = "TileSampleChannel";
        InitializeComponent();
        // Try to find the push channel.
        pushChannel = HttpNotificationChannel.Find(channelName);

        // If the channel was not found, then create a new connection to the push service.
        if (pushChannel == null)
        {
            pushChannel = new HttpNotificationChannel(channelName);

            // Register for all the events before attempting to open the channel.
            pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
            pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);

            pushChannel.Open();

            // Bind this new channel for Tile events.
            pushChannel.BindToShellTile();


        }
        else
        {
            // The channel was already open, so just register for all the events.
            pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
            pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);

            // Display the URI for testing purposes. Normally, the URI would be passed back to your web service at this point.
            System.Diagnostics.Debug.WriteLine(pushChannel.ChannelUri.ToString());
           // MessageBox.Show(String.Format("Channel Uri is {0}",pushChannel.ChannelUri.ToString()));

        }





 void PushChannel_ChannelUriUpdated(object sender, NotificationChannelUriEventArgs e)
    {

        Dispatcher.BeginInvoke(() =>
        {
            // Display the new URI for testing purposes. Normally, the URI would be passed back to your web service at this point.
            System.Diagnostics.Debug.WriteLine(e.ChannelUri.ToString());
           // MessageBox.Show(String.Format("Channel Uri is {0}", e.ChannelUri.ToString()));

        });
    }
    void PushChannel_ErrorOccurred(object sender, NotificationChannelErrorEventArgs e)
    {
        // Error handling logic for your particular application would be here.
        Dispatcher.BeginInvoke(() => MessageBox.Show(String.Format("A push notification {0} error occurred.  {1} ({2}) {3}",e.ErrorType, e.Message, e.ErrorCode, e.ErrorAdditionalData)) );
    }  

【问题讨论】:

    标签: c#-4.0 windows-phone-8 push-notification mpns live-tile


    【解决方案1】:

    以下是MPNS docs 对您收到的响应的评价(200 OK、Suppressed、Connected、Active):

    推送通知服务已接收并删除了推送通知。如果未通过在客户端应用程序中调用 BindToShellTile 或 BindToShellToast 启用通知类型,如果在应用程序不在前台时发送了原始通知,或者如果发送的 Tile 通知没有固定应用程序的 Tile,则可能会出现 Suppressed 状态开始。

    我看到您确实拨打了BindToShellTile,并且您没有发送原始通知,所以也许最后一个选项适用 - a Tile notification was sent with no Tile for the application pinned to start

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多