Software Archive
Read-only legacy content
17061 Discussions

How to preload data into localStorage or any of the supported Databases?

José_A_
Beginner
664 Views

It's for a game project. I have a list of units, with their attributes like speed, saved into an array in a js file. As the number of units and levels is growing the memory required worries me. I want to save them in a database and load only the ones used for each level.

Is it possible to save data in any of the supported databases at develop time so when the app is downloaded from an app store the database already contains that data?

I don't see how to do it. What I'm considering is that each unit is a resource text file. Then use AJAX to load the needed units for each level (Note that these resource files aren't remote, they go with the app). Same strategy for the files representing the game levels.

0 Kudos
1 Solution
Amrita_C_Intel
Employee
664 Views

Hello,

I would recommend using third party plugin SQLite. Which is listed in the featured plugin list as well. 

More details can be found here: https://www.npmjs.com/package/cordova-sqlite-storage

View solution in original post

0 Kudos
2 Replies
Amrita_C_Intel
Employee
665 Views

Hello,

I would recommend using third party plugin SQLite. Which is listed in the featured plugin list as well. 

More details can be found here: https://www.npmjs.com/package/cordova-sqlite-storage

0 Kudos
José_A_
Beginner
664 Views

It seems like the way to go. Then I just have to fill a sqlite file with all the unit and level data and then use that API to access it.

Thank you.

0 Kudos
Reply