UPDATE: The plot is thickening. I changed the name of my channel and it suddenly works (this means that this is not a problem with my push service, as I get the same HTTP response from the Microsoft Push Notification server).
For me, however, this is not a solution. How can I check this and KNOW that my users receive their push notifications if I get the same response when it does not work the way I do when it is?
[ORIGINAL POST]
I am trying to get push notifications sent to a Windows Phone 7 device, but I have very big problems that I cannot find answers to. I will start with C # code.
I set up push notifications using the following C # code.
private HttpNotificationChannel channel;
private static string PUSH_CHANNEL = "MySpecialPushChannel";
private Uri PushUri = null;
private bool IsPushRegistered = false;
public void StartPushSubscription()
{
try
{
channel = HttpNotificationChannel.Find(PUSH_CHANNEL);
}
catch
{}
if (channel != null)
{
PushUri = channel.ChannelUri;
if (!channel.IsShellTileBound)
channel.BindToShellTile();
}
else
{
channel = new HttpNotificationChannel(PUSH_CHANNEL);
channel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(channel_ChannelUriUpdated);
channel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(channel_HttpNotificationReceived);
channel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(channel_ErrorOccurred);
try
{
channel.Open();
channel.BindToShellTile();
}
catch (Exception err)
{
channel = null;
IsPushRegistered = false;
}
}
}
void channel_ChannelUriUpdated(object sender, NotificationChannelUriEventArgs e)
{
PushUri = e.ChannelUri;
IsPushRegistered = true;
}
I follow the standard WP7 push structure:
- Find the HttpNotificationChannel (or start a new one)
- , push- uri
- Uri ( , , push-
... . , Uri, . , push Uri ( , ). HTTP 200 :
DeviceConnectionStatus = >
NotificationStatus = >
SubscriptionStatus = > Active
... . push. , , , . , , , .