Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.0.0
belongs to Maven artifact androidx.webkit:webkit:1.0.0-rc01

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

added in version 1.0.0
public WebMessagePortCompat.WebMessageCallbackCompat ()

Public methods

onMessage

added in version 1.0.0
public void onMessage (WebMessagePortCompat port, 
                WebMessageCompat message)

Message callback for receiving onMessage events.

Parameters
port WebMessagePortCompat: the WebMessagePort that the message is destined for

message WebMessageCompat: the message from the entangled port. 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).