Running a script only once when app is installed
I have a javascript file which contains my application database schema and data .
I want that file to be executed only one time when application is installed on any device not each time the application starts running.
How can I perform that?
Thanks!
2 Answers
-
I would use the properties API to store a boolean value to track this. In app.js, you could do something like the following when your app runs:
var initialized = Ti.App.Properties.getBool("initHasRun"); if (!initialized) { //load up your database or whatever Ti.App.Properties.setBool("initHasRun",true); }
Some variation on that should get you the desired results.
-
Thanks Kevin and sorry to reply you so late
my problem has been solved with another solution