Created
April 3, 2016 08:03
-
-
Save dhavaln/304472752f3e4064cb3c1995bd398f8f to your computer and use it in GitHub Desktop.
Detect whether app is installed or updated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.pm.PackageInfo; | |
/* | |
* Utility class to check whether App is Updated of Fresh Installed | |
*/ | |
public class AppInfoUtil{ | |
public boolean isUpdated() throws Exception{ | |
PackageInfo info = null; | |
info = getPackageManager().getPackageInfo(getPackageName(), 0); | |
return info.firstInstallTime != info.lastUpdateTime; | |
} | |
public boolean isNewInstalled() throws Exception{ | |
PackageInfo info = null; | |
info = getPackageManager().getPackageInfo(getPackageName(), 0); | |
return info.firstInstallTime == info.lastUpdateTime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment