WebMessagePortCompat.WebMessageCallbackCompat
public
static
abstract
class
WebMessagePortCompat.WebMessageCallbackCompat
extends Object
java.lang.Object | |
↳ | androidx.webkit.WebMessagePortCompat.WebMessageCallbackCompat |
The listener for handling MessagePort events. The message callback
methods are called on the main thread. If the embedder application
wants to receive the messages on a different thread, it can do this
by passing a Handler in
WebMessagePortCompat.setWebMessageCallback(Handler, WebMessageCallbackCompat)
.
In the latter case, the application should be extra careful for thread safety
since WebMessagePort methods should be called on main thread.
Summary
Public constructors | |
---|---|
WebMessagePortCompat.WebMessageCallbackCompat()
|
Public methods | |
---|---|
void
|
onMessage(WebMessagePortCompat port, WebMessageCompat message)
Message callback for receiving onMessage events. |
Inherited methods | |
---|---|
Public constructors
WebMessagePortCompat.WebMessageCallbackCompat
public WebMessagePortCompat.WebMessageCallbackCompat ()
Public methods
onMessage
public void onMessage (WebMessagePortCompat port, WebMessageCompat message)
Message callback for receiving onMessage events.
This method is called only if WebViewFeature.WEB_MESSAGE_CALLBACK_ON_MESSAGE
is supported. You can check whether that flag is supported using
WebViewFeature.isFeatureSupported(String)
.
Parameters | |
---|---|
port |
WebMessagePortCompat : the WebMessagePort that the message is destined for |
message |
WebMessageCompat : the message from the entangled port.
|