i want to do some things in my code only for the old version of my app(not android version my apps version code ) not for the new downloads i tried to use this 

```
try {
     version = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
} catch (PackageManager.NameNotFoundException e) {
    e.printStackTrace();
}
if(version<2) {

}

```

and put loges in the if statement and i download my app what the current version is 1 and in my code i changed it to 2 and run it with the code above and it never reach he if block i assuming because it update the version before onCreate.
so my question is where should i put that if statement or is there a other way how to accomplish this.
 thanks for your help