com.nokia.notifications
Interface NotificationPayload


public interface NotificationPayload

NotificationPayload is the notification payload that is received from the service.


Field Summary
static java.lang.String ENCODING_BASE64
          Encoding value for binary data.
static java.lang.String ENCODING_NONE
          Payload is not encoded.
static java.lang.String ENCODING_STRING
          Encoding value when the payload is plain text.
static java.lang.String TYPE_APPLICATION_OCTET_STREAM
          Content type for binary data.
 
Method Summary
 byte[] getBase64Data()
           Returns the decoded Base64 data.
 java.lang.String getData()
          Returns the payload data as a string.
 java.lang.String getEncoding()
          Returns the encoding type of the data.
 java.lang.String getType()
          Returns the content type of the data.
 

Field Detail

ENCODING_BASE64

static final java.lang.String ENCODING_BASE64
Encoding value for binary data.

It is advised to use encoding value base64 for Base64 encoded content because that is automatically used for binary data that is sent by using the PUT method of the REST API.

See Also:
getEncoding(), Constant Field Values

ENCODING_STRING

static final java.lang.String ENCODING_STRING
Encoding value when the payload is plain text.

See Also:
getEncoding(), Constant Field Values

ENCODING_NONE

static final java.lang.String ENCODING_NONE
Payload is not encoded. MIDlet should handle missing encoding value as ENCODING_STRING.

See Also:
getEncoding(), Constant Field Values

TYPE_APPLICATION_OCTET_STREAM

static final java.lang.String TYPE_APPLICATION_OCTET_STREAM
Content type for binary data.

It is advised to use content type application/octet-stream for binary data because that is automatically used for binary data that is sent by using the PUT method of the REST API.

See Also:
getType(), Constant Field Values
Method Detail

getData

java.lang.String getData()
Returns the payload data as a string.

Returns:
payload data

getEncoding

java.lang.String getEncoding()
Returns the encoding type of the data.

Supported values are ENCODING_BASE64 and ENCODING_STRING but MIDlet specific custom values may also be defined.

Returns:
encoding type string or null if specific encoding value has not been set
See Also:
ENCODING_BASE64, ENCODING_STRING, ENCODING_NONE

getType

java.lang.String getType()
Returns the content type of the data.

Supported value is TYPE_APPLICATION_OCTET_STREAM but MIDlet specific custom values may also be defined. It is recommended to use IANA registered content types.

Returns:
content type string or null if specific content type has not been set
See Also:
TYPE_APPLICATION_OCTET_STREAM

getBase64Data

byte[] getBase64Data()
                     throws java.io.IOException

Returns the decoded Base64 data. This method may only be used if the payload has been encoded by using Base64. An empty array is returned if the payload is empty.

Returns:
the decoded Base64 data
Throws:
java.lang.IllegalStateException - if the encoding is not ENCODING_BASE64
java.io.IOException - if decoding the data failed, e.g. due to invalid encoding


Copyright © 2012 Nokia Corporation. All rights reserved.

Nokia is registered trademark of Nokia Corporation. Java and all Java-based marks are trademarks or registered trademarks of Oracle Corporation. Other product and company names mentioned herein may be trademarks or trade names of their respective owners. This document is confidential information of Nokia Corporation.

Disclaimer
The information in this document is provided "as is," with no warranties whatsoever, including any warranty of merchantability, fitness for any particular purpose, or any warranty otherwise arising out of any proposal, specification, or sample. Furthermore, information provided in this document is preliminary, and may be changed substantially prior to final release.

Nokia Corporation disclaims all liability, including liability for infringement of any proprietary rights, relating to this document and implementation of any information presented in this document.

Nokia Corporation retains the right to make changes to this document at any time, without notice.

License
Subject to above disclaimer, a license is hereby granted to use this documentation solely under existing Limited License Agreement and non-disclosure agreement between the companies for the agreed application development for Series 40 Nokia phones. No other licenses e.g. to any intellectual property rights are granted herein. Any use of the screen shots of this documentation, including any icons thereof, is subject to Nokia's prior written approval.