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);
}
Aggregations