title: Check if App is opened for the fist time after Launch/Updation in Android
body: <p>I want to run a service every time I open my App after the App is updated or installed for the first time. How do I check if App is opened for the first time after launch? </p>
  
  <p>I tried this but code in onCreate method but I'm getting isFirst= true on updating my code, however it should be blank/null so that I can run my service.
  Where am I wrong?</p>
  
  <pre><code>  @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
   isFirst = sPrefs.getString(Utility.KEY_IS_FIRST, "");
      if(isFirst == null || isFirst.equalsIgnoreCase("")){
          //run service and set isFirst = true
  
          SharedPreferences preferences = PreferenceManager
                  .getDefaultSharedPreferences(Activity_Home.this);
          SharedPreferences.Editor edit = preferences.edit();
          edit.putString(Utility.KEY_IS_FIRST, "true");
  
          edit.commit();
  }
  }
  </code></pre>