How to add a time stamp to apk file?
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
精彩评论