Search code examples
androidandroid-version

Android versionCode programmatically


Is there any way to know dynamically and programmatically the versionCode of an Android application??

I don´t know... maybe something like

 getApplicationContext.getVersionCode();

Thank you very much.


Solution

  • If you're using gradle (default in AndroidStudio) you can:

    BuildConfig.VERSION_CODE