我正在尝试添加插件并在我使用phonegap创建的android应用程序中使用它们。要创建应用程序,我遵循简单的教程phonegap web:
$ phonegap create my-app
$ cd my-app
$ phonegap run android
然后我想添加插件来删除缓存并添加到config.xml中 https://build.phonegap.com/plugins/876
<gap:plugin name="com.sharinglabs.cordova.plugin.cache" version="1.0.0" />
然后在我的控制器中添加了javascript代码来清除缓存:
document.addEventListener('deviceready', onDeviceReady);
function onDeviceReady()
{
var success = function(status) {
alert('Message: ' + status);
}
var error = function(status) {
alert('Error: ' + status);
}
window.cache.clear( success, error );
}
我做了一些更改以适应我的代码,虽然我想这不会是问题:
var ViewController = function(){
//Clean cache
window.cache.clear(cacheSuccess, cacheError);
}
ViewController.prototype = {
cacheSuccess: function(status) {
alert('Message: ' + status);
},
cacheError: function(status) {
alert('Error: ' + status);
}
}
new ViewController();
应用程序无法正常加载,我需要添加一些更多的js文件?可能是什么错误?