简体   繁体   English

替代已弃用的onExceededDatabaseQuota()

[英]Alternative to deprecated onExceededDatabaseQuota()

My app is executing some Javascript code in a WebView which creates a database. 我的应用程序正在WebView中执行一些创建数据库的Javascript代码。 In some situations when the database grows past a certain size I am getting this Javascript error: 在某些情况下,当数据库增长超过一定大小时,我收到此Javascript错误:

there was not enough remaining storage space, or the storage quota was reached and the user declined to allow more space 没有足够的剩余存储空间,或达到存储配额,用户拒绝允许更多空间

The historical workaround for this has been to override WebChromeClient.onExceededDatabaseQuota() which allows the native app code to increase the quota as needed. 历史解决方法是重写WebChromeClient.onExceededDatabaseQuota() ,它允许本机应用程序代码根据需要增加配额。 This has been deprecated since API level 19, though, and is no longer called. 但是,自API级别19以来,这已被弃用,并且不再被调用。 The Javadoc says: Javadoc说:

WebView now uses the HTML5 / JavaScript Quota Management API. WebView现在使用HTML5 / JavaScript配额管理API。

Is this new Quota Management API accessible to my Android app code? 这个新的配额管理API是否可以访问我的Android应用代码? Is there an alternative way for me to tell my WebView to increase the storage quota? 是否有另一种方法让我告诉我的WebView增加存储配额?

It turned out there was actually insufficient space left on the emulator's internal storage. 事实证明,仿真器的内部存储空间实际上没有足够的空间。 After I edited the AVD to give it more space, the error disappeared. 在我编辑AVD以给它更多空间后,错误消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM