Search in sources :

Example 1 with WebMessagePort

use of android.webkit.WebMessagePort in project cw-omnibus by commonsguy.

the class MainActivity method initPort.

@TargetApi(Build.VERSION_CODES.M)
private void initPort() {
    final WebMessagePort[] channel = wv.createWebMessageChannel();
    port = channel[0];
    port.setWebMessageCallback(new WebMessagePort.WebMessageCallback() {

        @Override
        public void onMessage(WebMessagePort port, WebMessage message) {
            postLux();
        }
    });
    wv.postWebMessage(new WebMessage("", new WebMessagePort[] { channel[1] }), Uri.EMPTY);
}
Also used : WebMessagePort(android.webkit.WebMessagePort) WebMessage(android.webkit.WebMessage) TargetApi(android.annotation.TargetApi)

Aggregations

TargetApi (android.annotation.TargetApi)1 WebMessage (android.webkit.WebMessage)1 WebMessagePort (android.webkit.WebMessagePort)1