WebViewCompat.WebMessageListener
public interface WebViewCompat.WebMessageListener
This listener receives messages sent on the JavaScript object which was injected by addWebMessageListener.
Summary
Public methods |
|
|---|---|
abstract void |
@UiThreadReceives a message sent by a |
Public methods
onPostMessage
@UiThread
abstract void onPostMessage(
@NonNull WebView view,
@NonNull WebMessageCompat message,
@NonNull Uri sourceOrigin,
boolean isMainFrame,
@NonNull JavaScriptReplyProxy replyProxy
)
Receives a message sent by a postMessage() on the injected JavaScript object.
Note that when the frame is file: or content: origin, the value of sourceOrigin is a string "null". However we highly recommend to not use file: or content: URLs, see WebViewAssetLoader for serving local content under http: or https: domain.
| Parameters | |
|---|---|
@NonNull WebView view |
The |
@NonNull WebMessageCompat message |
The message from JavaScript. |
@NonNull Uri sourceOrigin |
The origin of the frame that the message is from. |
boolean isMainFrame |
|
@NonNull JavaScriptReplyProxy replyProxy |
Used to reply back to the JavaScript object. |