Code example for ConsoleMessage

Methods: lineNumber, message, messageLevel, sourceId

0
         
        feedView.setWebChromeClient(new WebChromeClient() {
            @Override 
            public boolean onConsoleMessage(ConsoleMessage cm) {
 
                Log.i(TAG, cm.messageLevel() + ": " + cm.message() + " -- From line " + cm.lineNumber() + " of " + cm.sourceId() );
 
                return true; 
            } 
        }); 
 
        feedView.addJavascriptInterface(new Object() {
 
            @SuppressWarnings("unused") 
            public void foo() { 
                Log.i(TAG, "----- FOO CALLED -----");
                Toast.makeText(MainActivity.this, "foo called", Toast.LENGTH_LONG).show();
            } 
 
        }, "android");