Phonegap offline caching website

為{幸葍}努か 提交于 2019-12-10 23:56:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!