Skip to content

Instantly share code, notes, and snippets.

@iniyan455
Created September 17, 2020 09:12
Show Gist options
  • Save iniyan455/55cbffad4ec8aec6f6568dbc901afb93 to your computer and use it in GitHub Desktop.
Save iniyan455/55cbffad4ec8aec6f6568dbc901afb93 to your computer and use it in GitHub Desktop.
Temparing code to find in android code
And now you just need to call the method isHacked from your onCreate method in your initial Activity to check that your application was renamed or relocated.
public boolean isHacked(Context context, String myPackageName, String google, String amazon)
{
//Renamed?
if (context.getPackageName().compareTo(myPackageName) != 0) {
return true; // BOOM!
}
//Relocated?
String installer = context.getPackageManager().getInstallerPackageName(myPackageName);
if (installer == null){
return true; // BOOM!
}
if (installer.compareTo(google) != 0 && installer.compareTo(amazon) != 0){
return true; // BOOM!
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment