Increase the size of the WebSQL quota in a WebView

前端 未结 2 1280
野的像风
野的像风 2021-01-18 21:12

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 g

2条回答
  •  天命终不由人
    2021-01-18 22:01

    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.

提交回复
热议问题