Stay organized with collections Save and categorize content based on your preferences.

JavaScriptReplyProxy

public abstract class JavaScriptReplyProxy


This class represents the JavaScript object injected by WebViewCompat#addWebMessageListener. An instance will be given by WebMessageListener#onPostMessage. The app can use postMessage to talk to the JavaScript context.

There is a 1:1 relationship between this object and the JavaScript object in a frame.

See also
WebViewCompat

Summary

Public methods

abstract void
@RequiresFeature(name = WebViewFeature.WEB_MESSAGE_LISTENER, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
postMessage(@NonNull String message)

Post a String message to the injected JavaScript object which sent this .

Public methods

postMessage

@RequiresFeature(name = WebViewFeature.WEB_MESSAGE_LISTENER, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
public abstract void postMessage(@NonNull String message)

Post a String message to the injected JavaScript object which sent this .

Parameters
@NonNull String message

The data to send to the JavaScript context.