I am getting the error "Object doesn't support property or method 'addEventListener'" when my app is in snap view. This is my code
function
(channel) {
varpushNotifications = Windows.Networking.PushNotifications;
if(channel) {
channel.addEventListener(
"pushnotificationreceived",
pushNotificationReceivedHandler);
}
varcontent;
functionpushNotificationReceivedHandler(e)
{
varnotificationPayload;
switch(e.notificationType) {
casepushNotifications.PushNotificationType.toast:
notificationPayload = e.toastNotification.content.getXml();
break;
casepushNotifications.PushNotificationType.tile:
notificationPayload = e.tileNotification.content.getXml();
break;
casepushNotifications.PushNotificationType.badge:
notificationPayload = e.badgeNotification.content.getXml();
break;
casepushNotifications.PushNotificationType.raw:
notificationPayload = e.rawNotification.content;
break;
}
e.cancel =
true;
}
}