0

How can I query the versionCode (as declared in the manifest) from inside the app itself?

Should be easy enough (one might think), but of the usual suspects in the Android API, the only one that seems to have this kind of information is PackageInfo, which can be obtained through PackageManager, requiring me to explicitly specify the package.

Is there an easier way to specifically get the version code of the running app?

1

1 Answer 1

1

Registering Version code in the Manifest is deprecated, it kept in gradle script and injected into BuildConfig while building the APK/AAB. So, you can generate and use BuildConfig.VERSION_CODE field

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.