Skip to content

Instantly share code, notes, and snippets.

@dariush-fathie
Forked from scottyab/Installer
Created April 2, 2020 21:17
Show Gist options
  • Save dariush-fathie/5dad6d37cc616d9ed07fa846cd04ec9e to your computer and use it in GitHub Desktop.
Save dariush-fathie/5dad6d37cc616d9ed07fa846cd04ec9e 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