Last active
November 12, 2020 17:10
-
-
Save fm-sys/881458f9359dc711c2b6454d602d5edd to your computer and use it in GitHub Desktop.
[Android] check via SharedPreferences, if it's the very first appstart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean isFirstRun() { // returns true if it's the first start, otherwise false | |
boolean isFirstRun = getSharedPreferences("PREFERENCE", MODE_PRIVATE).getBoolean("isFirstRun", true); | |
if (isFirstRun){ | |
getSharedPreferences("PREFERENCE", MODE_PRIVATE) | |
.edit() | |
.putBoolean("isFirstRun", false) | |
.apply(); | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment