Muhammad Saifullah
Muhammad Saifullah

Reputation: 4292

How to check if app is running for the first time after installation?

How can I check the widnows phone 8.1 app is running for the first time after downloaded and installed the app on their devices?

My scenario is that, I want to create some tables using sqlite-net after the application is downloaded and running for the first time. and also what are the best practice of creating database/dataTables using sqlit-net which are being used in the app?

I am using windows phone 8.1 universal app.

Thanks

Upvotes: 0

Views: 355

Answers (1)

BradStevenson
BradStevenson

Reputation: 1994

For checking if it is the first time running you could set a value in

Windows.Storage.ApplicationData.Current.LocalSettings

And check this on app initialization.

e.g.

if(!Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey("FirstLaunch")){
    // Create Tables etc

    Windows.Storage.ApplicationData.Current.LocalSettings.Values["FirstLaunch"] = "Launched";
}

Upvotes: 3

Related Questions