I want to run a piece of code that will check if my app is first time installed and show my activity just like a tutorial(example: if a person installed a game their show some tutorial how to play the game) for the first time user. I have a 3 activity which is Splash screen, the main Activity and the profile. I don't know how to achieve it.
Asked
Active
Viewed 2,513 times
-3
-
watch onto this http://stackoverflow.com/questions/7217578/check-if-application-is-on-its-first-run – surhidamatya Apr 13 '15 at 09:14
2 Answers
3
The easiest thing you can do is save a boolean in sharedPreferences when your app runs and then check for it everytime your app starts, something like this:
if (mySharedPreferences().appAlreadyRun) {
//Your app has already been run at least once, so don't show tutorial
}
else{
//Your app is running for the first time
showTutorial();
mySharedPreferences().appAlreadyRun = true
}
Notice that this won't work, it's just "pseudoCode" to help you get the idea. Hope it helps

Sherekan
- 536
- 3
- 14
0
You should store a setting that you the user has runned it at least once.
If the settings is not there: first time If the settings is there: n th time
You can store the setting using SharedPreferences
: link to Android Dev

RvdK
- 19,580
- 4
- 64
- 107