I am trying to make it so my Android app will call a certain function but only if it's the first time the app is being run. Is there a special function or setting I can use to allow for this? Or do I have to use some hacky workaround by using shared preferences?
Asked
Active
Viewed 61 times
1
-
3Possible duplicate of [Determine if android app is the first time used](http://stackoverflow.com/questions/4636141/determine-if-android-app-is-the-first-time-used) – 323go Sep 23 '16 at 03:25
2 Answers
2
Just use shared preferences Boolean variable. When your app runs for the first time make the value false. It'll remain false until you change it or you uninstall the app from your phone.

Vishal Puri
- 823
- 8
- 15
0
Shared preferences, although I wouldn't call it hacky. Its pretty much how you do it on any OS- you check if a file exists, and run the code if not.

Gabe Sechan
- 90,003
- 9
- 87
- 127