Skip to content

Instantly share code, notes, and snippets.

@ZahidRasheed
Created February 10, 2017 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZahidRasheed/39e6163d14ff7b95e0fd7f5c5ef0b47c to your computer and use it in GitHub Desktop.
Save ZahidRasheed/39e6163d14ff7b95e0fd7f5c5ef0b47c to your computer and use it in GitHub Desktop.
Find if the app is installed from a trusted source
public static boolean isTrustedInstallation(Application app) {
PackageManager packageManager = app.getPackageManager();
String installerId = packageManager.getInstallerPackageName(app.getPackageName());
if (installerId == null) {
return false;
} else if (installerId.contains("aptoide")) {
return false;
} else if (installerId.contains("xiaomi")) {
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment