我正在尝试删除单个来源的WebStorage数据。首先显示大小(以检查是否要删除其中包含一些数据的原点),然后调用deleteOrigin。
final String origin = "https://developers.android.com/";
WebStorage.getInstance().getUsageForOrigin(origin, new ValueCallback<Long> () {
@Override
public void onReceiveValue(Long value) {
Log.d("TEST", "Before " + origin + " delete=" + value.toString());
// delete origin
WebStorage.getInstance().deleteOrigin(origin);
Log.d("TEST", origin + " deleted!");
}
});
在日志中,我看到:
2019-10-29 09:02:26.305 27887-27887/? D/TEST: Before https://developer.android.com/ delete=27793073
2019-10-29 09:02:26.311 27887-27887/? D/TEST: https://developer.android.com/ deleted!
但是当我运行几次时,甚至重新启动应用程序。该数字仍然相同:
2019-10-29 09:05:11.366 27887-27887/? D/TEST: Before https://developer.android.com/ delete=27793073
2019-10-29 09:05:11.369 27887-27887/? D/TEST: https://developer.android.com/ deleted!
2019-10-29 09:05:11.582 27887-27887/? D/TEST: Before https://developer.android.com/ delete=27793073
2019-10-29 09:05:11.586 27887-27887/? D/TEST: https://developer.android.com/ deleted!