Я пытаюсь отправить на телефон уведомление о плитке, используя эту библиотеку http://phpwindowsphonepush.codeplex.com/, но телефон не получает уведомление только при вводе URL-адреса удаленного изображения.Это мой простой php код
$uri="http://db3.notify.live.net/throttledthirdparty/01.00/AAEyQ7xxxxxxxxxxx";
$notif=new WindowsPhonePushNotification($uri);
$imm="http://www.mysite.net/imm/1.jpg";
$notif->push_tile($imm, "Title","2");
это код c #
private HttpNotificationChannel channel;
public MainPage()
{
InitializeComponent();
try
{
StartChannel();
}
catch (InvalidOperationException ioe)
{
HandleChannelException(ioe);
}
}
private void HandleChannelException(InvalidOperationException ioe)
{
MessageBox.Show(ioe.Message);
}
private void StartChannel()
{
channel = HttpNotificationChannel.Find("test1");
if (channel == null)
{
channel = new HttpNotificationChannel("test1", "name");
AddDelegates();
channel.Open();
}
else
{
AddDelegates();
}
if (channel.ChannelUri != null)
{
OnChannelReady();
}
}
private void AddDelegates()
{
channel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(channel_ChannelUriUpdated);
channel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(channel_ErrorOccurred);
channel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(channel_HttpNotificationReceived);
}
private void channel_HttpNotificationReceived(object sender, HttpNotificationEventArgs e)
{
StreamReader sr = new StreamReader(e.Notification.Body, Encoding.UTF8);
string text = sr.ReadToEnd();
this.Dispatcher.BeginInvoke(() => MessageBox.Show(text));
}
private void channel_ErrorOccurred(object sender, NotificationChannelErrorEventArgs e)
{
MessageBox.Show("ERROR");
}
private void channel_ChannelUriUpdated(object sender, NotificationChannelUriEventArgs e)
{
try
{
this.Dispatcher.BeginInvoke(OnChannelReady);
}
catch (InvalidOperationException ioe)
{
this.Dispatcher.BeginInvoke(() => HandleChannelException(ioe));
}
}
private void OnChannelReady()
{
if (!this.channel.IsShellTileBound)
this.channel.BindToShellTile();
}
это файл журнала:
* About to connect() to db3.notify.live.net port 80
* Trying xx.xx.xx.xxx... * connected
* Connected to db3.notify.live.net (xxx.xx.xx.xxx) port 80
> POST /throttledthirdparty/01.00/AAE0ykxoIaknSoMXxxxxxxxxxxxx HTTP/1.1
Host: db3.notify.live.net
Accept: */*
X-WindowsPhone-Target: token
X-NotificationClass: 1
Content-Length: 240
Content-Type: application/x-www-form-urlencoded
<?xml version="1.0" encoding="utf-8"?>
<wp:Notification xmlns:wp="WPNotification">
<wp:Tile>
<wp:BackgroundImage>http://www.mysite.net/imm/1.jpg</wp:BackgroundImage>
<wp:Count>2</wp:Count>
<wp:Title>6</wp:Title>
</wp:Tile>
</wp:Notification>< HTTP/1.1 200 OK
< Cache-Control: private
< Server: Microsoft-IIS/7.5
< X-DeviceConnectionStatus: Connected
< X-NotificationStatus: Received
< X-SubscriptionStatus: Active
< X-MessageID: 00000000-0000-0000-0000-000000000000
< ActivityId: xxxxxx-83fa-423d-8240-ec610eca749b
< X-Server: DB3MPNSM005
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ASP.NET
< Date: Tue, 07 Jun 2011 11:57:18 GMT
< Content-Length: 0
* Connection #0 to host db3.notify.live.net left intact
* Closing connection #0