的localStorage存储并非坚持在Android手机应用程序时,停止使用煎茶触摸2.2和PhoneGap的 [英] LocalStorage store not persisting on Android phone when app stops using Sencha Touch 2.2 and Phonegap
本文介绍了的localStorage存储并非坚持在Android手机应用程序时,停止使用煎茶触摸2.2和PhoneGap的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是工作的罚款在我的浏览器,但是当我安装应用程序在手机上,并用它......它看起来很好,直到我强迫其停止并重新打开应用程序,然后我所有的记录都没有了。
使用2.2和PhoneGap的进出口....任何帮助将是非常美联社preciated。这里是我的商店:
Ext.define('MyApp.store。presentations',{
延伸:Ext.data.Store,
配置:{
模型:MyApp.model presentations',
分拣机:'标题',
石斑鱼:功能(记录){
VAR大写= record.get('标题')[0] .toUpperCase();
返回大写; //标题的第一个字母 - 我们如何组合这些
},
自动加载:真,
代理: {
类型:localStorage的,
ID:presentations
}
}
});
我保存这样的:
新变种presentation = {标题:prezTitle,内容:'};
Ext.getStore('presentations')增加(新presentation)。
。VAR newRecord = Ext.getStore('presentations')同步();
解决方案
您可以通过添加以下code到DroidGap类的尝试:
super.appView.getSettings()setAllowFileAccess(真)。
super.appView.getSettings()setDatabaseEnabled(真)。
super.appView.getSettings()setDatabasePath(/数据/数据/+ appView.getContext()getPackageName()+/数据库/)。
super.appView.getSettings()setDomStorageEnabled(真)。
这行已经解决了,我得到了同样的问题。
This is working fine in my browser but when I install the app on my phone and use it ... it looks fine UNTIL I force it to stop and reopen the app and then all my records are gone.
Im using 2.2 and Phonegap.... any help would be VERY appreciated. Here is my store:
Ext.define('MyApp.store.Presentations', {
extend: 'Ext.data.Store',
config: {
model: 'MyApp.model.Presentations',
sorter: 'title',
grouper: function (record) {
var upperCased = record.get('title')[0].toUpperCase();
return upperCased; //First letter of the title - how we GROUP these
},
autoLoad: true,
proxy: {
type: 'localstorage',
id: 'presentations'
}
}
});
I save like this:
var newPresentation = { title: prezTitle, content: '' };
Ext.getStore('Presentations').add(newPresentation);
var newRecord = Ext.getStore('Presentations').sync();
解决方案
You can try by adding 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);
This lines have solved the same problem that i got
这篇关于的localStorage存储并非坚持在Android手机应用程序时,停止使用煎茶触摸2.2和PhoneGap的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文