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

后端 未结 2 1976
小鲜肉
小鲜肉 2021-02-11 14:22

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?

2条回答
  •  名媛妹妹
    2021-02-11 14:46

    Yes, you can access this information via PackageManager.getPackageInfo

    Also, see details about versioning in the documentation

提交回复
热议问题