Each application gets a way to save settings or parameters, so you can use it to see if the application was previously launched.
SharedPreferences runCheck = PreferenceManager.getSharedPreferences("hasRunBefore", 0); //load the preferences Boolean hasRun = runCheck.getBoolean("hasRun", false); //see if it run before, default no if (!hasRun) { SharedPreferences settings = getSharedPreferences("hasRunBefore", 0); SharedPreferences.Editor edit = settings.edit(); edit.putBoolean("hasRun", true); //set to has run edit.commit(); //apply //code for if this is the first time the app has run } else { //code if the app HAS run before }
source share