Search code examples
windows-phone-8push-notificationpushsharp

How to set Badge value for Windows Phone 8 using PushSharp


I am able to send Push Notification to the Windows Phone using PushSharp but i couldn't see any option for Notification Badge.
I am using following code to send notification to Windows devices

int badge = (String.IsNullOrEmpty(model.NotificationBadge)) ? 0 : int.Parse(model.NotificationBadge);
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;
push.RegisterWindowsPhoneService();
push.QueueNotification(new WindowsPhoneToastNotification()
     .ForEndpointUri(new Uri(model.ChannelURI))
     .ForOSVersion(WindowsPhoneDeviceOSVersion.Eight) 
     .WithBatchingInterval(BatchingInterval.Immediate)
     .WithNavigatePath(model.NavigatePath)
     .WithText1(model.NotificationText1)
     //.WithParameter("badge", "1")
     .WithText2(model.NotificationText2));

Can any body know how to send the Notification with Badge to the Windows Devices?

Your comments/suggestion would be highly appreciated!


Solution

  • Assuming you mean a tile badge to a Windows Phone device, you will want to send a tile notification (WindowsPhoneTileNotification) with the Count parameter set, not a toast notification.