1

My application not save dbtest.xml and not read when wi-fi turn off. It is file CordovaApp.java

package io.cordova.hellocordova;
import android.os.Bundle;
import android.webkit.WebSettings;
import org.apache.cordova.*;
public class CordovaApp extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.init();
        this.appView.getSettings().setDomStorageEnabled(true);
        this.appView.getSettings().setAppCacheMaxSize(1024 * 1024 * 15);  
        String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath();
        this.appView.getSettings().setAppCachePath(appCachePath);
        this.appView.getSettings().setAllowFileAccess(true);
        this.appView.getSettings().setAppCacheEnabled(true);
        // Set by <content src="index.html" /> in config.xml
        loadUrl(launchUrl);
    }
}

On server I add files .manifest, .htaccess and dbtext.xml .manifest look that:

CACHE MANIFEST
# Wersja 0.3
# Jawnie buforowane wpisy
dbtest.xml
# All other resources (e.g. sites) require the user to be online.
NETWORK:
*

.htaccess look that:

<mime-mapping>
<extension>manifest</extension>
<mime-type>text/cache-manifest</mime-type>
</mime-mapping> 

And my PhoneGap application not work offline. What i do wrong? I must add some text in other files? What i have to do ? Thanks

tomal271
  • 35
  • 10

1 Answers1

2

Although PhoneGap is an offline solution where the HTML, CSS and JS files etc are held in the assets/www folder within the app, there are some cases where you might want the app to point to a remote server where the HTML5 file and its CSS/JS are located. They can be downloaded onto your device and ran as offline files when the device has no Internet connection. Click Here for techniques

J.K
  • 2,290
  • 1
  • 18
  • 29
  • Previously already done everything according to the instructions on the page. The application works on wi-fi is turned off for 10 minutes sometimes for an hour sometimes offline. The data is then disappear. What could be the cause? – tomal271 Dec 17 '14 at 09:33