Skip to content

Most visited

Recently visited

navigation

WebMessage

public class WebMessage
extends Object

java.lang.Object
   ↳ android.webkit.WebMessage


The Java representation of the HTML5 PostMessage event. See https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces for definition of a MessageEvent in HTML5.

Summary

Public constructors

WebMessage(String data)

Creates a WebMessage.

WebMessage(String data, WebMessagePort[] ports)

Creates a WebMessage.

Public methods

String getData()

Returns the data of the message.

WebMessagePort[] getPorts()

Returns the ports that are sent with the message, or null if no port is sent.

Inherited methods

From class java.lang.Object

Public constructors

WebMessage

added in API level 23
WebMessage (String data)

Creates a WebMessage.

Parameters
data String: the data of the message.

WebMessage

added in API level 23
WebMessage (String data, 
                WebMessagePort[] ports)

Creates a WebMessage.

Parameters
data String: the data of the message.

ports WebMessagePort: the ports that are sent with the message.

Public methods

getData

added in API level 23
String getData ()

Returns the data of the message.

Returns
String

getPorts

added in API level 23
WebMessagePort[] getPorts ()

Returns the ports that are sent with the message, or null if no port is sent.

Returns
WebMessagePort[]

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)