问题
I have a website configured with cache manifest, which i will be loading in the android through phonegap. This is the following code that i am using
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("http://(192.168.14.46):8080/CacheTest/index.html");
this.appView.getSettings().setDomStorageEnabled(true);
this.appView.getSettings().setAppCacheMaxSize(1024 * 1024 * 15);
this.appView.getSettings().setAppCacheEnabled(true);
String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath();
this.appView.getSettings().setAppCachePath(appCachePath);
this.appView.getSettings().setAllowFileAccess(true);
//this.appView.getSettings().setAppCacheEnabled(true);
}
When i run this, the page is getting loaded properly. Then i turned of the server and i ran the application again. But this time i was getting an error saying that the url cannot be loaded.
But when i try the same in a PC using chrome browser its working fine , all the items are cached during the first time and i can view the website innumerable number of times though the server is turned off.
Does this mean that web view doesn't support caching? Or am i missing something?
I checked this code in Android 3.0 in samsung galaxy tab.
来源:https://stackoverflow.com/questions/15424499/phonegap-offline-caching-website