Get Application Installed Date on Android

Get Application Installed Date on Android

or this one (API Level 9 upwards!):

long installed = context
.getPackageManager()
.getPackageInfo(context.getPackag‌​eName(), 0)
.firstInstallTime
;

How to get current date and time of App Installation date in Android

Are you sure you need

context.getPackageManager().getPackageInfo("package.com.sqlitedemo"

instead of

context.getPackageManager().getPackageInfo("com.sqlitedemo"

Get Application Install time in Android 2.2?

Try this block. This solves your problem

PackageManager pm = getApplicationContext().getPackageManager();
try {
PackageInfo info = pm.getPackageInfo("com.google.android.googlequicksearchbox", 0);
Field field = PackageInfo.class.getField("firstInstallTime");
long timestamp = field.getLong(info);
Date date = new Date(timestamp);
Log.e("DATE", date + "");
} catch (NameNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SecurityException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalArgumentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (NoSuchFieldException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalAccessException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

How to get app install time from android

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

Android, Get Installed App Size and Date

Ajay,

To get the installation date you will want to use the PackageManager class. More specifically the getPackageInfo() method. This will return to you a PackageInfo object which contains firstInstallTime value.

There does not currently exist a public API to get an application's size as PackageManager.getpackageSizeInfo() was removed from the API from SDK 0.9 to SDK 1.0. See HERE

Good luck!



Related Topics



Leave a reply



Submit