I am trying to get the install time
of all the applications installed in my Android Phone with OS 2.2, but I am not getting exactly the time they were installed, instead I am getting today's date and time. I know that I can get it thorough:
packageManager.getPackageInfo(packageName, 0).firstInstallTime;
but this is available for API level 9
onwards and I need to get firstInstallTime
in API level 8
.
Searching revealed me another way of achieving it, but it gives today's date, instead of app's install date.
PackageManager pm = context.getPackageManager();
ApplicationInfo appInfo = pm.getApplicationInfo("app.package.name", 0);
String app = appInfo.sourceDir;
long installedTime = new File(app).lastModified();
Any idea how can Iget my desired result? Please update. Any help is appreciated.