I'm creating a Phonegap Android app and I'm having trouble when adding a plugin to it. Cordova version is 2.2.0. I'm not using jQM or Sencha Touch. I test the app on Android 4.0.
The plugin I refer to is Android Phonegap plugin. This is my index.html
file:
<!DOCTYPE html> <html> <head> ... </head> <body> <div class="wrapper"> ... </div> <script type="text/javascript" src="vendor/cordova-2.2.0.js"></script> <script type="text/javascript" src="assets/application.js"></script> <script type="text/javascript" src="js/index.js"></script> <script type="text/javascript" src="js/datePickerPlugin.js"></script> </body> </html>
This is my main Java file:
import android.app.Activity; import android.os.Bundle; import org.apache.cordova.*; public class looker extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setIntegerProperty("splashscreen", R.drawable.splash); super.loadUrl("file:///android_asset/www/index.html", 7000); } }
So in order to understand if the problem is within the plugin, I minimized this file in assets/application.js
where all my minimized scripts I use are. I removed the script tag for the plugin from index.html
and the plugin was working just fine! So it's got something to do with the URL's maybe?
What have I tried so far?
I was researching a lot and tried several solutions to other similar problems.
Made sure I have 3 /'s for the
loadUrl
in my main class:public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setIntegerProperty("splashscreen", R.drawable.splash); super.loadUrl("file:///android_asset/www/index.html", 7000); }
Had that from the very beginning, didn't make any difference.
Tried calling super.init() before super.loadUrl(). Didn't work as well.
Tried this:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); super.setIntegerProperty("loadUrlTimeoutValue", 6000); super.loadUrl("file:///android_asset/www/index.html"); }
Still not fixing the problem.
Checked if the file is loaded in the app, by adding an
alert();
. It loads.
That's in general. Will be glad to provide you with additional info if needed in order to resolve this issue. Thanks in advance!