0

I need a way to detect if this is the first time the user is ever opening the application, if so, start an activity. Then all previous application launches wouldn't start that activity. I've read in a few places about using preferences to accomplish this. Anyone got any ideas?

bschultz
  • 4,244
  • 1
  • 25
  • 33
  • check: http://stackoverflow.com/questions/2133986/how-to-know-my-android-application-has-been-upgraded-in-order-to-reset-an-alarm – Macarse Jun 02 '10 at 19:24

3 Answers3

1

Yeah, preferences is the way to go.

Check for the existence of the preference flag, if that exists you have already set, so your application was already started. Otherwise start your welcome activity and set the flag for future.

Pentium10
  • 204,586
  • 122
  • 423
  • 502
0

what if you have a user who deletes the application data in the device settings. This also removes the sharedPreferences data. The OP said he/she needs a way to determine if "ever" the user has opened an application. Shared Pref is not full proof.

j2emanue
  • 60,549
  • 65
  • 286
  • 456
0

You can also disable one main activity and enable another one after your intro has run. See: the docs for PackageManager.setComponentEnabledSetting.

joeo
  • 421
  • 3
  • 4