I am trying to send a push notification in my windows phone 7.1 which is throwing error:
PushSharp.WindowsPhone.WindowsPhoneNotificationSendFailureException
Following is the middle-ware code written in server side:
var push = new PushBroker();
push.OnNotificationSent += NotificationSent;
push.OnChannelException += ChannelException;
push.OnServiceException += ServiceException;
push.OnNotificationFailed += NotificationFailed;
push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
push.OnChannelCreated += ChannelCreated;
push.OnChannelDestroyed += ChannelDestroyed;
// WINDOWS PHONE NOTIFICATIONS
push.RegisterWindowsPhoneService();
push.QueueNotification(new WindowsPhoneToastNotification()
.ForEndpointUri(new Uri(url))
.ForOSVersion(WindowsPhoneDeviceOSVersion.Seven)
.WithBatchingInterval(BatchingInterval.Immediate)
// .WithNavigatePath("/MainPage.xaml")
.WithText1("Notification")
.WithText2("This is a push notification"));
push.StopAllServices(waitForQueuesToFinish: true);
The Push sharp handler methods are:
//this even raised when a notification is successfully sent
static void NotificationSent(object sender, INotification notification)
{
Debug.WriteLine("Sent: " + sender + " -> " + notification);
}
//this is raised when a notification is failed due to some reason
static void NotificationFailed(object sender, INotification notification, Exception notificationFailureException)
{
Debug.WriteLine("Failure: " + sender + " -> " + notificationFailureException.Message + " -> " + notification);
}
From Front End using VS 2010 for windows phone framework I am sending the URL something like this which is auto generated:
Notification channel URI:http://db3.notify.live.net/throttledthirdparty/01.00/AQE9Hz23hR07RYiaH7O3SeEkAgAAAAADAQAAAAQUZm52OjIzOEQ2NDJDRkI5MEVHHSNLL8wMQ
But unfortunately, I am receiving the following exception :
Failure: PushSharp.WindowsPhone.WindowsPhonePushService -> Exception of type 'PushSharp.WindowsPhone.WindowsPhoneNotificationSendFailureException' was thrown. -> <wp:Notification xmlns:wp="WPNotification">
Help me out. Thanks in advance.
The Same Code worked when I tried with the Device
not Emulator. May be that error occurred because of dummy credentials.