com.windowsazure.messaging.MpnsNotification Maven / Gradle / Ivy
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
package com.windowsazure.messaging;
import org.apache.hc.core5.http.ContentType;
/**
* This class represents a Windows Phone notification.
*/
public class MpnsNotification extends Notification {
/**
* Creates a new instance of the MpnsNotification class.
* @param body The XML body for the Windows Phone PNS.
*/
public MpnsNotification(String body) {
this.body = body;
this.headers.put("ServiceBusNotification-Format", "windowsphone");
if (body.contains("")) {
this.headers.put("X-WindowsPhone-Target", "toast");
this.headers.put("X-NotificationClass", "2");
}
if (body.contains("")) {
this.headers.put("X-WindowsPhone-Target", "tile");
this.headers.put("X-NotificationClass", "1");
}
if (body.startsWith("<")) {
this.contentType = ContentType.APPLICATION_XML;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy