Skip to content

Instantly share code, notes, and snippets.

@scottyab
Created September 17, 2014 14:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scottyab/c7f73bcc164890d84131 to your computer and use it in GitHub Desktop.
Save scottyab/c7f73bcc164890d84131 to your computer and use it in GitHub Desktop.
Tamper checks
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
public class InstallerCheck{
private static final String PLAY_STORE_APP_ID = "com.google.android";
public static boolean verifyInstaller(final Context context) {
final String installer = context.getPackageManager()
.getInstallerPackageName(context.getPackageName());
return installer != null
&& installer.startsWith(PLAY_STORE_APP_ID);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment