code: static long getFirstInstallTime(Context context) {
          long firstTime = 0L;
          if (context != null) {
              try {
                  final PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
                  firstTime = packageInfo.firstInstallTime;
              } catch (Exception e) {
                  PrefHelper.LogException("Error obtaining FirstInstallTime", e);
              }
          }
  
          return firstTime;
      }
docs: Get the time at which the app was first installed, in milliseconds.
  @param context Context.
  @return the time at which the app was first installed.