在应用程序中显示Android应用程序.apk创建日期 [英] Display the Android application.apk creation date in Application

查看:164
本文介绍了在应用程序中显示Android应用程序.apk创建日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Android应用程序,我想显示 .apk 的版本,现在我可以使用<$ c来显示应用程序版本的应用程序$ c> PackageInfo ,现在我想显示创建应用程序的日期或 .apk 创建日期。

I am developing an android application, i want to display the Version of the .apk and date now i can able to display app version of the application using PackageInfo and now i want to display the date when app is created or .apk creation date.

推荐答案

检查上次修改classes.dex的日期的方法,这意味着上次建立应用程式代码时:

Method which checks date of last modification of classes.dex, this means last time when your app's code was built:

 try{
 ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), 0);
 ZipFile zf = new ZipFile(ai.sourceDir);
 ZipEntry ze = zf.getEntry("classes.dex");
 long time = ze.getTime();
 String s = SimpleDateFormat.getInstance().format(new java.util.Date(time));

 }catch(Exception e){
 }

这篇关于在应用程序中显示Android应用程序.apk创建日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆