Detect my app's own android:versionCode at run time

后端 未结 3 2044
[愿得一人]
[愿得一人] 2021-02-11 13:52

Is there a way for my app to know the android:versionCode from AndroidManifest.xml or do I have to create a separate constant in one of my classes?

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-11 14:49

    You can get version code simply from .BuildConfig#VERSION_CODE reference. It is generated by ADT plugin/Intellij.

提交回复
热议问题