安裝時間和更新時間
要獲得安裝或更新應用的時間,你應該查詢 Android 的包管理器。
try {
// Reference to Android's package manager
PackageManager packageManager = this.getPackageManager();
// Getting package info of this application
PackageInfo info = packageManager.getPackageInfo(this.getPackageName(), 0);
// Install time. Units are as per currentTimeMillis().
info.firstInstallTime
// Last update time. Units are as per currentTimeMillis().
info.lastUpdateTime
} catch (NameNotFoundException e) {
// Handle the exception
}