-1

I want to check if my app is the first time launched ? , Can Anyone help me.

ADM
  • 20,406
  • 11
  • 52
  • 83

1 Answers1

1

Try this:

fun isFirstOpen(): Boolean {
        val pref = this.getPreferences(MODE_PRIVATE)
        val isFirst = pref.getBoolean("key", true)
        with(pref.edit()){
            putBoolean("key", false)
            commit()
        }
        return isFirst
    }
Iulian
  • 38
  • 5