Determine the time and date of installing an application on Android

0

Is it possible to get the exact date and time that your user installed the application?

On iOS7 +, you can get a receipt for when the application was downloaded using [NSBundle appStoreReceiptURL] .

    
asked by anonymous 27.08.2015 / 19:24

1 answer

1

Getting the Installation Time and Date

You can get the install time and date the first time the app was installed through packageManager :

long installTime = context.getPackageManager()
                   .getPackageInfo("com.some.package.name", 0)
                   .firstInstallTime;

And their respective version:

PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
version = pInfo.versionName;

Unfortunately, this date is reset every time the application is re-installed.

If you use the following code

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

You'll be able to determine the app install date on Android, but the time will always change when it's updated.

    
27.08.2015 / 19:24