增加WebSQL配额的数目,在web视图 [英] Increase the size of the WebSQL quota in a WebView
问题描述
在一个正常的Android网络应用程序的WebSQL数据库的最大大小通常约为8MB。在混合网络应用程序我提出我想增加此限制。我怎么会去这样做?
In a normal Android web app the maximum size for a WebSQL database is normally around 8MB. In a hybrid web app I am making I would like to increase this limit. How would I go about doing that?
看来 WebStorage 可能有一些用它做,但我可以看到那里的唯一方法似乎设置大小, setQuotaForOrigin
,被标记的德precated 的。
It seems that WebStorage might have something to do with it, but the only method I can see there that seems to set the size, setQuotaForOrigin
, is marked deprecated.
样品code(不是去precated)是值得欢迎的:)
Sample code (that is not deprecated) is welcome :)
推荐答案
配额的web应用程序似乎是从一个混合的应用程序的不同(如在一个视图中运行的东西)。无论如何,通过实现你的 android.app.Activity
子下面,你将增加一倍的配额直到最后停在大约48MB。
The quota for a web app seems to differ from that of a hybrid app (as in something running within a view). Regardless, by implementing the following in your android.app.Activity
subclass you will double the quota until it finally stops at approximately 48MB.
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize, long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater) {
quotaUpdater.updateQuota(estimatedSize * 2);
}
用户不会被要求进行交互时发生这种情况。
The user will not be asked to interact when this happens.
这篇关于增加WebSQL配额的数目,在web视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!