Get Application Installed Date on Android Get Application Installed Date on Android android android

Get Application Installed Date on Android


or this one (API Level 9 upwards!):

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


Use this code:

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


Try one of these

/** * The time at which the app was first installed. Units are as per currentTimeMillis(). * @param context * @return */public static long getAppFirstInstallTime(Context context){    PackageInfo packageInfo;    try {    if(Build.VERSION.SDK_INT>8/*Build.VERSION_CODES.FROYO*/ ){        packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);        return packageInfo.firstInstallTime;    }else{        //firstinstalltime unsupported return last update time not first install time        ApplicationInfo appInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 0);        String sAppFile = appInfo.sourceDir;        return new File(sAppFile).lastModified();    }    } catch (NameNotFoundException e) {    //should never happen    return 0;    }}