Skip to content

Instantly share code, notes, and snippets.

View higekick's full-sized avatar

IKEGAMI Yuto higekick

View GitHub Profile
View android_installation_date.java
ApplicationInfo appInfo = getPackageManager().getApplicationInfo(getPackageName(), 0);
long lastInstallTime = new File(appInfo.sourceDir).lastModified();
Log.d("INSTALL_TIME".TAG, "install time = " + Long.toString(lastInstallTime)); //1.
PackageInfo pkgInfo = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_META_DATA);
Log.d("INSTALL_TIME", "firstInstallTime = " + Long.toString(pkgInfo.firstInstallTime)); //2.
Log.d("INSTALL_TIME", "firstInstallTime = " + Long.toString(pkgInfo.lastUpdateTime)); //3.