public abstract class

WebMessagePortCompat.WebMessageCallbackCompat

extends java.lang.Object

 java.lang.Object

↳androidx.webkit.WebMessagePortCompat.WebMessageCallbackCompat

Overview

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, WebMessagePortCompat.WebMessageCallbackCompat). In the latter case, the application should be extra careful for thread safety since WebMessagePort methods should be called on main thread.

Summary

Constructors
publicWebMessageCallbackCompat()

Methods
public voidonMessage(WebMessagePortCompat port, WebMessageCompat message)

Message callback for receiving onMessage events.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public WebMessageCallbackCompat()

Methods

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: the WebMessagePort that the message is destined for
message: the message from the entangled port.