I am creating a Phonegap Android application and I am having trouble adding a plugin to it. Cordoba's version is 2.2.0. I do not use jQM or Sencha Touch. I am testing an application on Android 4.0.
The plugin I'm referring to is the Android Phonegap plugin . This is my file index.html:
<!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 in the plugin, I minimized this file to assets/application.jswhere all my minimal scripts I use. I removed the script tag for the plugin from index.html, and the plugin worked just fine! So this has something to do with the url?
What have i tried so far?
I understood a lot and tried several times to solve other similar problems.
, 3/ loadUrl :
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl("file:///android_asset/www/index.html", 7000);
}
.
super.init() super.loadUrl(). .
:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.init();
super.setIntegerProperty("loadUrlTimeoutValue", 6000);
super.loadUrl("file:///android_asset/www/index.html");
}
.
, , alert();. .
. , , . !