1

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer! I diddn't get to try it out yet - I'll let you know if it worked for me. It sounds defenetly useful and like it might work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.