Reputation: 376
I'm looking for a good way to initialize my app (create database, populate database, download assets etc.) on its first startup.
All I can think of right now is to use @loaded
event or the created
method in combination with some flags in the key-value storage. This feels like it might be too much of a dirty workarround tho.
Is there a "proper way" to do this?
Upvotes: 1
Views: 87
Reputation: 1078
You can use nativescript-secure-storage which has a method isFirstRun() or isFirstRunSync() which you can call to check if it is the first app run.
Accordingly you can do your stuff in the callback of this function.
Add your code in app.js and you're set.
Upvotes: 1