How to send a Badge notification

We have learned how create object to send a notification, now we can send the notification.

How you can see, all previous documentation is summarized in this script.

//get token
$tok = GetToken();
//get a channel
$cha = GetNewChannel();
$Options = new WindowsNotification\WNSNotificationOptions();
$Options->SetAuthorization(new WindowsNotification\OAuthObject($tok)));
$Options->SetX_WNS_REQUESTFORSTATUS(WindowsNotification\X_WNS_RequestForStatus::Request);
//NOTE: Set the badge type
$Options->SetX_WNS_TYPE(WindowsNotification\X_WNS_Type::Badge);
$Notifier = new WindowsNotification\WindowsNotificationClass($Options);
//send a numeric badge 
$Notifier->Send($cha,WindowsNotification\TemplateBadge::NumericBadge(5));
//send a default badge
$cha = GetNewChannel();
$Notifier->Send($cha,WindowsNotification\TemplateBadge::Attention);

Last edited May 16, 2015 at 4:28 PM by Andreabbondanza, version 3