Returns the timestamp at the first install of the current versionCode of this app that Apptentive was aware of.
175970
public Apptentive.DateTime getTimeAtInstallForVersionCode(int versionCode) {
		for (VersionHistoryItem item : versionHistoryItems) {
			if (item.getVersionCode() == versionCode) {
				return new Apptentive.DateTime(item.getTimestamp());
			}
		}
		return new Apptentive.DateTime(Util.currentTimeSeconds());
	}
663860
private void buildApplicationData(Context context) throws JSONException {
        app = new JSONObject();
        app.put("package", context.getPackageName());
        try {
            PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
            app.put("versionCode", info.versionCode);
            app.put("versionName", info.versionName);
            // TODO firstInstallTime and lastUpdate
        } catch (NameNotFoundException e) {
            // Cannot happen as we're checking a know package.
        }
    }
533971
public static String getVersion()
  {
    String rev = getBuildRevision();
    Date date = getBuildDate();
    StringBuilder result = new StringBuilder();

    result.append(getReleaseName());
    if (!"".equals(rev) || date != null)
    {
      result.append(" (");

      boolean added = false;
      if (!"".equals(rev))
      {
        result.append("rev. ");
        result.append(rev);
        added = true;
      }
      if (date != null)
      {
        result.append(added ? ", built " : "");

        SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        result.append(d.format(date));
      }

      result.append(")");
    }

    return result.toString();
  }
1012624
def getTimeSinceLastUpdate(IOType):
    """"""
    global last_update_times
    # assert(IOType in ['net', 'disk', 'process_disk'])
    current_time = time()
    last_time = last_update_times.get(IOType)
    if not last_time:
        time_since_update = 1
    else:
        time_since_update = current_time - last_time
    last_update_times[IOType] = current_time
    return time_since_update
210645
public static int getAppVersion(@NonNull final Context context) {
        try {
            final PackageInfo packageInfo = context.getPackageManager()
                    .getPackageInfo(context.getPackageName(), 0);
            return packageInfo.versionCode;
        } catch (PackageManager.NameNotFoundException ignore) {
            // ignore
        }

        return Integer.MIN_VALUE;
    }
624146
def get_version():
    """"""

    path = os.path.join(os.path.dirname(__file__), 'backrefs')
    fp, pathname, desc = imp.find_module('__meta__', [path])
    try:
        vi = imp.load_module('__meta__', fp, pathname, desc).__version_info__
        return vi._get_canonical(), vi._get_dev_status()
    except Exception:
        print(traceback.format_exc())
    finally:
        fp.close()
471518
def find_first_version(self):
        """"""
        for version in self.versions_to_try:
            remote_url = self.get_download_url(version=version)
            if http_url_exists(remote_url):
                return version, remote_url
        return None, None
979521
def get_version():
    """"""
    contents = read_file(os.path.join('admirarchy', '__init__.py'))
    version = re.search('VERSION = \(([^)]+)\)', contents)
    version = version.group(1).replace(', ', '.').strip()
    return version
1008500
def fetch_app_version(options)
      metadata = AppRepo::Uploader.new(options).download_manifest_only
      FastlaneCore::UI.command_output('TODO: Parse version out from metadata')
      puts JSON.pretty_generate(metadata) unless metadata.nil?
      FastlaneCore::UI.important('TODO: parse out the bundle-version')
      metadata['bundle-version']
    end
553169
private String getDefaultVersion(Set<String> keys, String appName) {
    SortedSet<String> listOfApps = new TreeSet<String>();
    for (String key : keys) {
      if (key.split(":")[0].contentEquals(appName)) {
        listOfApps.add(key);
      }
    }
    return listOfApps.size() > 0 ? listOfApps.last() : null;
  }
218120
public synchronized static String installedVersion() {
        BufferedReader versionReader = null;
        try {
            versionReader = new BufferedReader(new FileReader(BMP_LOCAL_VERSION_FILE));

            // Read version and verify it's there
            String version = versionReader.readLine();
            if (null == version) throw new Exception();

            return version;
        } catch(Exception e) {
            throw new BMPCLocalNotInstalledException(
                    "Version file not found: " + BMP_LOCAL_VERSION_FILE);
        } finally {
            try {
                if (null != versionReader) versionReader.close();
            } catch (IOException e) {
                // Do nothing here
            }
        }
    }
1156950
function() {
    let detectedVersion;

    if (this._options.useAppVersion && this._appVersion) {
      detectedVersion = this._appVersion;
    }

    if (!detectedVersion) {
      detectedVersion = this.parent.pkg.version;
    }

    if (detectedVersion && this._options.enabled) {
      const fileName = this._options.fileName;

      this.ui.writeLine(`Created ${fileName} with ${detectedVersion}`);
      return writeFile(fileName, detectedVersion);
    }
  }
100287
def get_previous_version(self):
        """"""
        gh = self.get_github_api()
        repo = gh.repository(self.repo_owner, self.repo_name)
        most_recent = None
        for release in repo.releases():
            # Return the second release that matches the release prefix
            if release.tag_name.startswith(self.project__git__prefix_release):
                if most_recent is None:
                    most_recent = release
                else:
                    return LooseVersion(self.get_version_for_tag(release.tag_name))
420531
def get_version(self, cached=True):
        """"""
        if hasattr(self.__class__, '_version') and cached:
            version = self.__class__._version
        else:
            repo = self.get_repo()
            if repo is not None:
                head = repo.head
                version = head.commit.hexsha
                if repo.is_dirty():
                    version += "*"
            else:
                version = None
        self.__class__._version = version
        return version
1166722
public static int getVersionCode(Context context) {
        int versionCode;
        try {
            versionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;
        } catch (NameNotFoundException e) {
            versionCode = -999;
        }
        return versionCode;
    }
724291
public static void resetIfAppVersionChanged(Context context) {
        SharedPreferences prefs = getSharedPreferences(context);

        int appVersionCode = Integer.MIN_VALUE;
        final int previousAppVersionCode = prefs.getInt(PREF_KEY_APP_VERSION_CODE, Integer.MIN_VALUE);
        try {
            appVersionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            Log.w(TAG, "Occurred PackageManager.NameNotFoundException", e);
        }

        if (previousAppVersionCode != appVersionCode) {
            SharedPreferences.Editor prefsEditor = prefs.edit();
            prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, 0);
            prefsEditor.putLong(PREF_KEY_APP_THIS_VERSION_CODE_LAUNCH_COUNT, 0);
            prefsEditor.putLong(PREF_KEY_APP_FIRST_LAUNCHED_DATE, 0);
            prefsEditor.putInt(PREF_KEY_APP_VERSION_CODE, Integer.MIN_VALUE);
            prefsEditor.putLong(PREF_KEY_RATE_CLICK_DATE, 0);
            prefsEditor.putLong(PREF_KEY_REMINDER_CLICK_DATE, 0);
            prefsEditor.putBoolean(PREF_KEY_DO_NOT_SHOW_AGAIN, false);
            prefsEditor.commit();
        }
    }
1129916
public static String getVersionCode(Context context) {
        if (sVersion == null) {
            try {
                sVersion = context.getPackageManager().getPackageInfo(
                        context.getPackageName(), 0).versionName;
            } catch (PackageManager.NameNotFoundException e) {
                // Can't find version; just leave it blank.
                Log.e(TAG, "Error finding package " + context.getApplicationInfo().packageName);
            }
        }
        return sVersion;
    }