本文介绍了Android 2.3.6 + Phonegap + localStorage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用phonegap& jQuery mobile.

I'm developing a mobile app using phonegap & jQuery mobile.

我收到来自质量检查部门的报告,称其在Samsung Galaxy Y(android 2.3.6)上-localStorage为null,因此导致应用崩溃.

I'm having reports from QA that on the Samsung Galaxy Y (android 2.3.6) - localStorage is null and therefore causing the app to crash.

据我所知,Android 2.0及更高版本应支持localStorage,我甚至向DroidGap类添加了以下代码:

As far as I can tell, localStorage should be supported from android versions 2.0+, and I have even added the following code to the DroidGap class:

super.appView.getSettings().setAllowFileAccess(true);        
super.appView.getSettings().setDatabaseEnabled(true);
super.appView.getSettings().setDatabasePath("/data/data/" + appView.getContext().getPackageName() + "/databases/");
super.appView.getSettings().setDomStorageEnabled(true);    

因此,我很难理解为什么在此特定设备上似乎不支持localStorage.有人告诉我,它甚至可以在具有相同Android版本的其他设备上正常运行!

So I'm struggling to understand why localStorage doesn't seem to be supported on this particular device. I'm told that it even runs OK on other devices with the same version of Android!

是否存在我不知道的任何设置或其他事项,可能导致localStorage为空?

Are there any settings or other things I'm not aware of that could cause localStorage to be null??

推荐答案

事实证明,将Phonegap(cordova)从1.8.1升级到2.0.0可以解决此问题.

So it turns out by upgrading Phonegap (cordova) from 1.8.1 to 2.0.0 fixes the issue....

这篇关于Android 2.3.6 + Phonegap + localStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 21:41