Main Launcher on Android

384 Views Asked by At

I'm developing an android aplication that in the first time its used asks to configure the data and a keyword, after completing this form is directed to a homepage. In the second use, and in the following the main launcher happens to be a login, where you have to put the keyword that you configured previously and only after that you have access to the application's menu. My difficulty is in the first use, I use a main launcher and in the following I need to use a different main launcher.

1

There are 1 best solutions below

3
Prexx On BEST ANSWER

You could check if the app was started the first time using SharedPreferences in your onCreate and if so, start your configuration activity:

val prefs = getSharedPreferences("com.example", Context.MODE_PRIVATE)
val startedFirstTime = prefs.getBoolean("firstTime", true) // Returns true, if nothing was saved before
if(startedFirstTime) {
    prefs.edit().putBoolean("firstTime", false).apply()
    // TODO Start your configuration activity
}

SharedPreferences are used to store simple data.