I am developing an android app using phonegap/cordova 2.0.0.
As of right now, I have a website hosted on my server and my android app is just being used as a wrapper webView.
Here's the code in my java file.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
webview = new WebView(this);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webview.addJavascriptInterface(new JavaScriptInterface(), "jsinterface");
setContentView(webview);
// This is where I load the URL of my website
webview.loadUrl("http://192.168.0.109:3000/");
}
When I deploy the app to an android phone, it works perfectly fine, I am able to see my website in the phone.
The problem I am facing now is to use phonegap plugin especially ChildBrowser (other plugins give me the same result). I have this exception that is being thrown on my javascript console:
window.plugins.childBrowser.showWebPage("http://www.example.com")
TypeError: Object #<an Object> has no method 'exec'
I followed the instructions on how to use the plugin ChildBrowser Plugin
I have included the javascript files on my website hosted on my server
<script src="/assets/cordova-2.0.0.js" type="text/javascript"></script>
<script src="/assets/childbrowser.js" type="text/javascript"></script>
I have spent days trying to figure that out and googled everything I could try. But no luck for me since none of the solutions has worked for me. I tried the deviceready option but it didn't work:
document.addEventListener("deviceready", yourCallbackFunction, false);
Does anybody have a solution for that or is it even possible to call phonegap plugins from an external website?
PS: I have a working example of ChildBrowser but my android app is reading from
super.loadUrl("file:///android_asset/www/index.html");