<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_65) on Mon Oct 13 10:56:30 EDT 2014 --> <TITLE> PushNotificationPayload </TITLE> <META NAME="date" CONTENT="2014-10-13"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="PushNotificationPayload"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javapns/notification/PushNotificationManager.html" title="class in javapns.notification"><B>PREV CLASS</B></A> <A HREF="../../javapns/notification/ResponsePacket.html" title="class in javapns.notification"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?javapns/notification/PushNotificationPayload.html" target="_top"><B>FRAMES</B></A> <A HREF="PushNotificationPayload.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> javapns.notification</FONT> <BR> Class PushNotificationPayload</H2> <PRE> <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> <IMG SRC="../../resources/inherit.gif" ALT="extended by "><A HREF="../../javapns/notification/Payload.html" title="class in javapns.notification">javapns.notification.Payload</A> <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>javapns.notification.PushNotificationPayload</B> </PRE> <HR> <DL> <DT><PRE>public class <B>PushNotificationPayload</B><DT>extends <A HREF="../../javapns/notification/Payload.html" title="class in javapns.notification">Payload</A></DL> </PRE> <P> A payload compatible with the Apple Push Notification Service. <P> <P> <DL> <DT><B>Author:</B></DT> <DD>Maxime Peron, Sylvain Pedneault</DD> </DL> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#PushNotificationPayload()">PushNotificationPayload</A></B>()</CODE> <BR> Create a default payload with a blank "aps" dictionary.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#PushNotificationPayload(java.lang.String)">PushNotificationPayload</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> rawJSON)</CODE> <BR> Construct a Payload object from a JSON-formatted string.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#PushNotificationPayload(java.lang.String, int, java.lang.String)">PushNotificationPayload</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> alert, int badge, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sound)</CODE> <BR> Create a payload and immediately add an alert message, a badge and a sound.</TD> </TR> </TABLE> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#addAlert(java.lang.String)">addAlert</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> alertMessage)</CODE> <BR> Add a simple alert message.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#addBadge(int)">addBadge</A></B>(int badge)</CODE> <BR> Add a badge.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#addCategory(java.lang.String)">addCategory</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> category)</CODE> <BR> Add a category.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#addCustomAlertActionLocKey(java.lang.String)">addCustomAlertActionLocKey</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> actionLocKey)</CODE> <BR> Create a custom alert (if none exist) and add a custom text for the right button of the popup.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#addCustomAlertBody(java.lang.String)">addCustomAlertBody</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> body)</CODE> <BR> Create a custom alert (if none exist) and add a body to the custom alert.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#addCustomAlertLaunchImage(java.lang.String)">addCustomAlertLaunchImage</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> launchImage)</CODE> <BR> Create a custom alert (if none exist) and add a launch-image parameter.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#addCustomAlertLocArgs(java.util.List)">addCustomAlertLocArgs</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A> args)</CODE> <BR> Create a custom alert (if none exist) and add sub-parameters for the loc-key parameter.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#addCustomAlertLocKey(java.lang.String)">addCustomAlertLocKey</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> locKey)</CODE> <BR> Create a custom alert (if none exist) and add a loc-key parameter.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#addSound(java.lang.String)">addSound</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sound)</CODE> <BR> Add a sound.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#alert(java.lang.String)">alert</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> message)</CODE> <BR> Create a pre-defined payload with a simple alert message.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#badge(int)">badge</A></B>(int badge)</CODE> <BR> Create a pre-defined payload with a badge.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#combined(java.lang.String, int, java.lang.String)">combined</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> message, int badge, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sound)</CODE> <BR> Create a pre-defined payload with a simple alert message, a badge and a sound.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#complex()">complex</A></B>()</CODE> <BR> Create an empty payload which you can configure later.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#fromJSON(java.lang.String)">fromJSON</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> rawJSON)</CODE> <BR> Create a PushNotificationPayload object from a preformatted JSON payload.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#getMaximumPayloadSize()">getMaximumPayloadSize</A></B>()</CODE> <BR> Return the maximum payload size in bytes.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#sound(java.lang.String)">sound</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sound)</CODE> <BR> Create a pre-defined payload with a sound name.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../javapns/notification/PushNotificationPayload.html#test()">test</A></B>()</CODE> <BR> Create a special payload with a useful debugging alert message.</TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_javapns.notification.Payload"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class javapns.notification.<A HREF="../../javapns/notification/Payload.html" title="class in javapns.notification">Payload</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../javapns/notification/Payload.html#addCustomDictionary(java.lang.String, int)">addCustomDictionary</A>, <A HREF="../../javapns/notification/Payload.html#addCustomDictionary(java.lang.String, java.util.List)">addCustomDictionary</A>, <A HREF="../../javapns/notification/Payload.html#addCustomDictionary(java.lang.String, java.lang.String)">addCustomDictionary</A>, <A HREF="../../javapns/notification/Payload.html#asSimulationOnly()">asSimulationOnly</A>, <A HREF="../../javapns/notification/Payload.html#estimatePayloadSizeAfterAdding(java.lang.String, java.lang.Object)">estimatePayloadSizeAfterAdding</A>, <A HREF="../../javapns/notification/Payload.html#getCharacterEncoding()">getCharacterEncoding</A>, <A HREF="../../javapns/notification/Payload.html#getExpiry()">getExpiry</A>, <A HREF="../../javapns/notification/Payload.html#getPayload()">getPayload</A>, <A HREF="../../javapns/notification/Payload.html#getPayloadAsBytes()">getPayloadAsBytes</A>, <A HREF="../../javapns/notification/Payload.html#getPayloadSize()">getPayloadSize</A>, <A HREF="../../javapns/notification/Payload.html#isEstimatedPayloadSizeAllowedAfterAdding(java.lang.String, java.lang.Object)">isEstimatedPayloadSizeAllowedAfterAdding</A>, <A HREF="../../javapns/notification/Payload.html#isPayloadSizeEstimatedWhenAdding()">isPayloadSizeEstimatedWhenAdding</A>, <A HREF="../../javapns/notification/Payload.html#setCharacterEncoding(java.lang.String)">setCharacterEncoding</A>, <A HREF="../../javapns/notification/Payload.html#setExpiry(int)">setExpiry</A>, <A HREF="../../javapns/notification/Payload.html#setPayloadSizeEstimatedWhenAdding(boolean)">setPayloadSizeEstimatedWhenAdding</A>, <A HREF="../../javapns/notification/Payload.html#toString()">toString</A></CODE></TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> </TR> </TABLE> <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="PushNotificationPayload()"><!-- --></A><H3> PushNotificationPayload</H3> <PRE> public <B>PushNotificationPayload</B>()</PRE> <DL> <DD>Create a default payload with a blank "aps" dictionary. <P> </DL> <HR> <A NAME="PushNotificationPayload(java.lang.String)"><!-- --></A><H3> PushNotificationPayload</H3> <PRE> public <B>PushNotificationPayload</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> rawJSON) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Construct a Payload object from a JSON-formatted string. If an aps dictionary is not included, one will be created automatically. <P> <DL> <DT><B>Parameters:</B><DD><CODE>rawJSON</CODE> - a JSON-formatted string (ex: {"aps":{"alert":"Hello World!"}} ) <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE> - thrown if a exception occurs while parsing the JSON string</DL> </DL> <HR> <A NAME="PushNotificationPayload(java.lang.String, int, java.lang.String)"><!-- --></A><H3> PushNotificationPayload</H3> <PRE> public <B>PushNotificationPayload</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> alert, int badge, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sound) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Create a payload and immediately add an alert message, a badge and a sound. <P> <DL> <DT><B>Parameters:</B><DD><CODE>alert</CODE> - the alert message<DD><CODE>badge</CODE> - the badge<DD><CODE>sound</CODE> - the name of the sound <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE></DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="alert(java.lang.String)"><!-- --></A><H3> alert</H3> <PRE> public static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A> <B>alert</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> message)</PRE> <DL> <DD>Create a pre-defined payload with a simple alert message. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>message</CODE> - the alert's message <DT><B>Returns:</B><DD>a ready-to-send payload</DL> </DD> </DL> <HR> <A NAME="badge(int)"><!-- --></A><H3> badge</H3> <PRE> public static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A> <B>badge</B>(int badge)</PRE> <DL> <DD>Create a pre-defined payload with a badge. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>badge</CODE> - the badge <DT><B>Returns:</B><DD>a ready-to-send payload</DL> </DD> </DL> <HR> <A NAME="sound(java.lang.String)"><!-- --></A><H3> sound</H3> <PRE> public static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A> <B>sound</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sound)</PRE> <DL> <DD>Create a pre-defined payload with a sound name. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>sound</CODE> - the name of the sound <DT><B>Returns:</B><DD>a ready-to-send payload</DL> </DD> </DL> <HR> <A NAME="combined(java.lang.String, int, java.lang.String)"><!-- --></A><H3> combined</H3> <PRE> public static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A> <B>combined</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> message, int badge, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sound)</PRE> <DL> <DD>Create a pre-defined payload with a simple alert message, a badge and a sound. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>message</CODE> - the alert message<DD><CODE>badge</CODE> - the badge<DD><CODE>sound</CODE> - the name of the sound <DT><B>Returns:</B><DD>a ready-to-send payload</DL> </DD> </DL> <HR> <A NAME="test()"><!-- --></A><H3> test</H3> <PRE> public static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A> <B>test</B>()</PRE> <DL> <DD>Create a special payload with a useful debugging alert message. <P> <DD><DL> <DT><B>Returns:</B><DD>a ready-to-send payload</DL> </DD> </DL> <HR> <A NAME="complex()"><!-- --></A><H3> complex</H3> <PRE> public static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A> <B>complex</B>()</PRE> <DL> <DD>Create an empty payload which you can configure later. This method is usually used to create complex or custom payloads. Note: the payload actually contains the default "aps" dictionary required by APNS. <P> <DD><DL> <DT><B>Returns:</B><DD>a blank payload that can be customized</DL> </DD> </DL> <HR> <A NAME="fromJSON(java.lang.String)"><!-- --></A><H3> fromJSON</H3> <PRE> public static <A HREF="../../javapns/notification/PushNotificationPayload.html" title="class in javapns.notification">PushNotificationPayload</A> <B>fromJSON</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> rawJSON) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Create a PushNotificationPayload object from a preformatted JSON payload. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>rawJSON</CODE> - a JSON-formatted string representing a payload (ex: {"aps":{"alert":"Hello World!"}} ) <DT><B>Returns:</B><DD>a ready-to-send payload <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE> - if any exception occurs parsing the JSON string</DL> </DD> </DL> <HR> <A NAME="addBadge(int)"><!-- --></A><H3> addBadge</H3> <PRE> public void <B>addBadge</B>(int badge) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Add a badge. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>badge</CODE> - a badge number <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE></DL> </DD> </DL> <HR> <A NAME="addSound(java.lang.String)"><!-- --></A><H3> addSound</H3> <PRE> public void <B>addSound</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> sound) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Add a sound. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>sound</CODE> - the name of a sound <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE></DL> </DD> </DL> <HR> <A NAME="addAlert(java.lang.String)"><!-- --></A><H3> addAlert</H3> <PRE> public void <B>addAlert</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> alertMessage) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Add a simple alert message. Note: you cannot add a simple and a custom alert in the same payload. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>alertMessage</CODE> - the alert's message <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE></DL> </DD> </DL> <HR> <A NAME="addCategory(java.lang.String)"><!-- --></A><H3> addCategory</H3> <PRE> public void <B>addCategory</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> category) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Add a category. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>alertMessage</CODE> - the category <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE></DL> </DD> </DL> <HR> <A NAME="addCustomAlertBody(java.lang.String)"><!-- --></A><H3> addCustomAlertBody</H3> <PRE> public void <B>addCustomAlertBody</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> body) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Create a custom alert (if none exist) and add a body to the custom alert. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>body</CODE> - the body of the alert <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE> - if the custom alert cannot be added because a simple alert already exists</DL> </DD> </DL> <HR> <A NAME="addCustomAlertActionLocKey(java.lang.String)"><!-- --></A><H3> addCustomAlertActionLocKey</H3> <PRE> public void <B>addCustomAlertActionLocKey</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> actionLocKey) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Create a custom alert (if none exist) and add a custom text for the right button of the popup. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>actionLocKey</CODE> - the title of the alert's right button, or null to remove the button <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE> - if the custom alert cannot be added because a simple alert already exists</DL> </DD> </DL> <HR> <A NAME="addCustomAlertLocKey(java.lang.String)"><!-- --></A><H3> addCustomAlertLocKey</H3> <PRE> public void <B>addCustomAlertLocKey</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> locKey) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Create a custom alert (if none exist) and add a loc-key parameter. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>locKey</CODE> - <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE> - if the custom alert cannot be added because a simple alert already exists</DL> </DD> </DL> <HR> <A NAME="addCustomAlertLocArgs(java.util.List)"><!-- --></A><H3> addCustomAlertLocArgs</H3> <PRE> public void <B>addCustomAlertLocArgs</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A> args) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Create a custom alert (if none exist) and add sub-parameters for the loc-key parameter. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>args</CODE> - <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE> - if the custom alert cannot be added because a simple alert already exists</DL> </DD> </DL> <HR> <A NAME="addCustomAlertLaunchImage(java.lang.String)"><!-- --></A><H3> addCustomAlertLaunchImage</H3> <PRE> public void <B>addCustomAlertLaunchImage</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> launchImage) throws <A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></PRE> <DL> <DD>Create a custom alert (if none exist) and add a launch-image parameter. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>launchImage</CODE> - <DT><B>Throws:</B> <DD><CODE><A HREF="../../javapns/json/JSONException.html" title="class in javapns.json">JSONException</A></CODE> - if the custom alert cannot be added because a simple alert already exists</DL> </DD> </DL> <HR> <A NAME="getMaximumPayloadSize()"><!-- --></A><H3> getMaximumPayloadSize</H3> <PRE> public int <B>getMaximumPayloadSize</B>()</PRE> <DL> <DD>Return the maximum payload size in bytes. For APNS payloads, this method returns 256. <P> <DD><DL> <DT><B>Overrides:</B><DD><CODE><A HREF="../../javapns/notification/Payload.html#getMaximumPayloadSize()">getMaximumPayloadSize</A></CODE> in class <CODE><A HREF="../../javapns/notification/Payload.html" title="class in javapns.notification">Payload</A></CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>the maximum payload size in bytes (256)</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javapns/notification/PushNotificationManager.html" title="class in javapns.notification"><B>PREV CLASS</B></A> <A HREF="../../javapns/notification/ResponsePacket.html" title="class in javapns.notification"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?javapns/notification/PushNotificationPayload.html" target="_top"><B>FRAMES</B></A> <A HREF="PushNotificationPayload.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>