code: private static void storeInstallDate(final Context context, SharedPreferences.Editor editor) {
          Date installDate = new Date();
          if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
              PackageManager packMan = context.getPackageManager();
              try {
                  PackageInfo pkgInfo = packMan.getPackageInfo(context.getPackageName(), 0);
                  installDate = new Date(pkgInfo.firstInstallTime);
              } catch (PackageManager.NameNotFoundException e) {
                  e.printStackTrace();
              }
          }
          editor.putLong(KEY_INSTALL_DATE, installDate.getTime());
          log("First install: " + installDate.toString());
      }
docs: Store install date.
  Install date is retrieved from package manager if possible.
  @param context
  @param editor