To use the database API you have to configure your WebView to accept HTML5 database calls:
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
...
settings.setDatabaseEnabled(true);
settings.setDatabasePath("/data/data/your.package.name/database_name");
You may also override the onExceededDatabaseQuota method of your WebChromeClient if you want to control your storage quota:
public void onExceededDatabaseQuota(String url, String
databaseIdentifier, long currentQuota, long estimatedSize, long
totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) {
quotaUpdater.updateQuota(204801);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…