Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,782,291 Members 47,543 Now Online
XDA Developers Android and Mobile Development Forum

[Q] Market update deletes the stored data

Tip us?
 
badcoke.com
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: Apr 2014
Database [Q] Market update deletes the stored data

I made an phonegap app, which is using websql for storing data. Everything works fine, it is on Google Play. The problem is when I update it (from the market) it erases all of the data which is stored in the websql. My question is, how can I solve this problem? How can I solve it, not to erase all of the data, when I update is?
 
Archer
Old
(Last edited by Archer; 2nd April 2014 at 06:10 PM.)
#2  
Archer's Avatar
Senior Moderator / Recognized Developer - (Un)Recognized Pole Dancer
Thanks Meter 4,007
Posts: 13,733
Join Date: Jul 2008
Location: Northampton
Quote:
Originally Posted by badcoke.com View Post
I made an phonegap app, which is using websql for storing data. Everything works fine, it is on Google Play. The problem is when I update it (from the market) it erases all of the data which is stored in the websql. My question is, how can I solve this problem? How can I solve it, not to erase all of the data, when I update is?
The data associated with the app should only be deleted when you either uninstall the app or delete it manually (of course). Do you have anything in your code that initialises the database? I assume you create a database & table structure somewhere - are you sure you're not running that again?
.
"I live by my own rules, nobody else's, not even my own."
.
My xda links

New User Guide | XDA Forum Rules | 10 Posts - Why and How? | Admins & Mods | My xda Bookmarks

.

.
 
badcoke.com
Old
#3  
Junior Member - OP
Thanks Meter 0
Posts: 2
Join Date: Apr 2014
Quote:
Originally Posted by Archer View Post
The data associated with the app should only be deleted when you either uninstall the app or delete it manually (of course). Do you have anything in your code that initialises the database? I assume you create a database & table structure somewhere - are you sure you're not running that again?
I am sure, that that the database is not running again.
Here is my code:


Code:
function databaseFunction () {
var db,
len,
bx,
res = [];

this.open = function(levelDone) {
db = openDatabase('worderDd', '1.0', 'Test DB', 5 * 1024 * 1024);
var msg;
}

this.create = function() {
db.transaction(function (tx) {
  tx.executeSql('CREATE TABLE IF NOT EXISTS worderDd (id INTEGER PRIMARY KEY AUTOINCREMENT, level)');
});
} 

this.addData = function (levelDone) {
db.transaction(function (tx) {
  tx.executeSql('INSERT INTO worderDd (level) VALUES (?)', [levelDone]);
  
    alert('AWWWWWWESOME! LEVEL COMPLETED');
window.location.replace("index.html");
});

}

Unfortunately the stored data is missing from this section of the code when update it through the market
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes