开发者

How to add a time stamp to apk file?

开发者 https://www.devze.com 2023-04-06 20:10 出处:网络
I want to add a \"about\" item to my android application, and I want to displa开发者_如何学Pythony the apk\'s compile and build time in this item.

I want to add a "about" item to my android application, and I want to displa开发者_如何学Pythony the apk's compile and build time in this item. How can I achieve this? Any suggestion? Thanks.:-)


I'd say include it into your android:versionName attribute. You probably have to modify that with a build-script though.

The version number shown to users. This attribute can be set as a raw string or as a reference to a string resource. The string has no other purpose than to be displayed to users. The versionCode attribute holds the significant version number used internally.

You can read that at runtime via

ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0).versionName

ctx is a Context instance, you can use this in every activity or service instead

0

精彩评论

暂无评论...
验证码 换一张
取 消