我的应用程序不保存 dbtest.xml 并且在 wi-fi 关闭时不读取。 它是文件 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);
}
}
在服务器上,我添加文件 .manifest、.htaccess 和 dbtext.xml .manifest 看起来:
CACHE MANIFEST
# Wersja 0.3
# Jawnie buforowane wpisy
dbtest.xml
# All other resources (e.g. sites) require the user to be online.
NETWORK:
*
.htaccess 看起来:
<mime-mapping>
<extension>manifest</extension>
<mime-type>text/cache-manifest</mime-type>
</mime-mapping>
而且我的 PhoneGap 应用程序不能离线工作。我做错了什么?我必须在其他文件中添加一些文本吗?我必须做什么? 谢谢
最佳答案
虽然 PhoneGap 是一个离线解决方案,其中 HTML、CSS 和 JS 文件等保存在应用程序内的 assets/www 文件夹中,但在某些情况下,您可能希望应用程序指向 HTML5 文件所在的远程服务器及其 CSS/JS 位于。它们可以下载到您的设备上,并在设备没有 Internet 连接时作为脱机文件运行。 Click Here for techniques
关于android - HTML5 Android Phonegap Web 应用离线缓存 list ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27521895/