Using the Cordova plugin is the recommended approach to expose Java code to the JavaScript level of your application. Take a look at the Plugin Development Guide and Plugin Development on Android .
addJavascriptInterface is part of the Android WebView API and is used internally by Apache Cordova Code for Android . There is at least one bug with Android 2.3, and this method can be avoided with the Apache Cordova plugin system.
What are the differences in using a plugin or appView.addJavascriptInterface?
The difference is that the Cordova plugin is a higher-level abstraction that allows you to consistently output your own code from various platforms (Android, iOS, among others), to the WebView that runs your JavaScript code. While addJavascriptInterface is an Android-specific method that is part of the WebView API that uses the Apache Cordova Android code.
source share