I'm developping a mobile app using Cordova (3.4). My core application files are embedded in my app archive (.apk or .ipa), and some files (js/html/css) must be retrieved from my server. So if I want my application usable offline I need to use appcache for these files.
A sample of my appcache.manifest :
CACHE MANIFEST
# version 7
NETWORK:
*
http://*
https://*
CACHE:
# Message module
http://my.server.ip/module/routes.json
http://my.server.ip/module/css/style.css
http://my.server.ip/module/js/controller.js
http://my.server.ip/module/js/service.js
...
My index.html (embedded into my app) :
<!DOCTYPE html>
<html lang="en" xmlns:ng="http://angularjs.org" id="ng-app" ng-app="app"
manifest="http://my.server.ip/tmp_appcache.manifest">
...
<body>
<script>
document.addEventListener("deviceready", function(e) {
var appCache = window.applicationCache;
alert('device ready');
console.log('appCache', appCache);
// Fired after the first cache of the manifest.
appCache.addEventListener('cached', function(event) {
console.log(event);
alert('Appcache OK');
}, false);
appCache.addEventListener('UpdateReady', function(event) {
console.log(event);
alert('Appcache Reloaded');
}, false);
appCache.addEventListener('error', function(event) {
console.log(event);
alert('Appcache ERROR');
}, false);
appCache.addEventListener('checking', function(event) {
console.log(event);
alert('Appcache CHECKING');
}, false);
appCache.addEventListener('downloading', function(event) {
console.log(event);
alert('Appcache DOWNLOADING');
}, false);
appCache.addEventListener('noupdate', function(event) {
console.log(event);
alert('Appcache NOUPDATE');
}, false);
appCache.addEventListener('obsolete', function(event) {
console.log(event);
alert('Appcache OBSOLETE');
}, false);
}, false);
</body>
</html>
My problem is, when I launch my pp (on Android AND iOS), I didn't see any of my alert (except the "device ready"), and no file is cached.
If I open the url of my webapp in the device browser I actually see my alert.
Is there an additional configuration to do in Phonegap to allow appcache ?
I've seen some article about enabling appcache in Android, but it seems to be for older version of cordova, furthermore it doesn't work for me and if it's the origin of my problem, appcache should work on iOS.
Any idea would be helpful. Thanks