android获取程序安装时间

虽然google有在PackageInfo里提供firstInstallTime这个接口(其实是一个public字段),但似乎无用,返回值为零。google了下 真正可以获取安装时间要变通下


PackageManager pm = context.getPackageManager();
ApplicationInfo appInfo = pm.getApplicationInfo("app.package.name", 0);
String appFile = appInfo.sourceDir;
long installed = new File(appFile).lastModified(); //Epoch Time


http://stackoverflow.com/questions/2831333/how-to-get-app-install-time-from-android

你可能感兴趣的:(android,String,Google,File)