tags:

views:

45

answers:

1

Hi,

I am writing a android application where I want to register my application to remoter server when application is first launched on installation. Application will register to remoter server itself without taking any user input. How Can I track whether this is a first application launch after installation ?

+5  A: 

By setting a shared preference:

SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor edit = prefs.edit();
edit.setBoolean("launched", true);
edit.commit();

You can check for it on each launch with:

boolean launched = prefs.getBoolean("launched", false);
synic
Thanks synic for your quick response!!
cppdev