Saving Data

  • 1
  • Question
  • Updated 9 years ago
Hi ive looked around alot and cant find an easy way to save data. the easiest way I found was using a database SQL. Is there a easier way? Also If there isnt an easier way I wanted to know how to SQL work exactly. I know how to open a database but how do I reopen when someone reopens the app. I have been using this code to open the database. Will this make one/open the database.

var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000);
Photo of starsoccer9

starsoccer9

  • 20 Posts
  • 0 Reply Likes
  • frustrated

Posted 9 years ago

  • 1
Photo of Andrew Lunny

Andrew Lunny

  • 1911 Posts
  • 199 Reply Likes
You would want to subscribe to the resume event, as detailed here:
http://docs.phonegap.com/phonegap_eve...

You can also use key-value storage if you have simpler data to store:
http://developer.apple.com/library/sa...
Photo of starsoccer9

starsoccer9

  • 20 Posts
  • 0 Reply Likes
I have already used a database and I have it all set up. my only question is when I do var db = window.openDatabase("Database", "1.0", "PhoneGap Demo", 200000)
will it reopen the database with the current database
Photo of Andrew Lunny

Andrew Lunny

  • 1911 Posts
  • 199 Reply Likes
Yes - it will use the existing database.
Photo of starsoccer9

starsoccer9

  • 20 Posts
  • 0 Reply Likes
ok thank you