关于Android中查看app安装时间等信息的问题

时间:2021-10-08 05:35:16
PackageManager packageManager=this.getPackageManager();
try {
PackageInfo packageInfo=packageManager.getPackageInfo(this.getPackageName(), 0);
long firstInstallTime=packageInfo.firstInstallTime;//应用第一次安装的时间
int versionCode=packageInfo.versionCode;//应用现在的版本号
String versionName=packageInfo.versionName;//应用现在的版本名称
System.out.println("firstInstallTime="+firstInstallTime+",versionCode="+versionCode+",versionName="+versionName); //如下可获得更多信息
ApplicationInfo applicationInfo=packageInfo.applicationInfo;
String name=applicationInfo.name;
String packageName=applicationInfo.packageName;
String permission=applicationInfo.permission;
} catch (Exception e) {
e.printStackTrace();
}

timestamp转time(string)

C++:利用char* ctime(const time_t *Const_ctime)

Java:timestamp.toString()