This question already has an answer here:
How can I know if it is the first time the application launched?
If you are answering please add a full code because I have read some answers and I didn't understand them.
Thanks.
This question already has an answer here:
How can I know if it is the first time the application launched?
If you are answering please add a full code because I have read some answers and I didn't understand them.
Thanks.
I don't know if this is the best solution, but...
I tried storing a simple boolean in the Android's file system and when starting the android app, checking if that boolean exists and what it's value is.
Again, not sure if this is the proper way to do it, it's just my own way of getting around this.
Use
sharedPreferences
for the persistent data storage.when the application first launched just save a boolean value in the shared Preferences.Then check each time.You might want to refer to http://developer.android.com/guide/topics/data/data-storage.html#pref.
You can load a boolean when you execute your application for the first time to the shared preferences, and then check if it true in following runs, so you know the program has already been run once.
Every app gets a way to store preferences or options, so you can have one for whether or not the app has previously run