Android的 - 让web视图DomStorage持久性应用程序关闭后, [英] Android - Making Webview DomStorage persistant after app closed

查看:298
本文介绍了Android的 - 让web视图DomStorage持久性应用程序关闭后,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在面临一个巨大的问题,开发一个Android应用程序,它使用web视图来显示DATAS。我使用的web视图的网站上使用HTML 5中的localStorage API。

I'm facing a huge problem developing an Android app which use a Webview to display datas. The website i'm using in the webview use localStorage API of HTML 5.

要启用此功能,我设置web视图像这样设置:

To enable this feature i've set the webview setting like this :

webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setJavaScriptEnabled(true);

所以localStorage的API的工作,但是当我关闭该应用程序(和杀死进程),localStorage的是完全地抹去,当我重新加载它,我的所有的数据都是丢失。

So the localStorage API works but when I close the app (and kill the process), localStorage is completly erased and when I reload it, all my datas are lost.

我的问题很简单:如何让一个web视图的DomStorage持续性,即使我们关闭应用程序

My question is simple : How to make DomStorage of a Webview persistant even when we close the app ?

感谢你为未来的答案。

推荐答案

你设置DatabasePath? Android不知道在哪里保存DOMDatabase在默认情况下,如果不设置调用

Did you set the DatabasePath? Android doesn't know where to save the DOMDatabase by default, if you don't set it calling

webview.getSettings().setDatabasePath()

这篇关于Android的 - 让web视图DomStorage持久性应用程序关闭后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆