- Home /
Identify which android market app is downloaded
Is it possible to identify if an apk is downloaded from Google Play or Amazone?
Depends on what you're talking about. Do you mean to detect if some App on the Users phone has been downloaded from a specific source or if your App was downloaded from one of those sites?
I guess that you could just build two version and just change one file/variable for each site.
I need to know if my app was downloaded from which site. The purpose is to avoid having to apks for each site.
Hello Guys,
I wanted to know if there is a direct unity plugin available for the same as we want to implement the same for our game.
Thank you, Raviraj.
Answer by viraf · Jan 14, 2017 at 08:46 AM
You can use Application.installerName
https://docs.unity3d.com/ScriptReference/Application-installerName.html
Answer by Dominic Cerisano · Feb 12, 2014 at 04:02 AM
This is the Android API code for checking the package installer name of an app. It is pretty secure, since the vendor is not stored in your app, but rather comes from the signed download service running on the user's device (eg. com.android.vending). Currently, only playstore and amazon report this. Seems that as of this writing, iOS and other platforms can also report this, but not in a secure way - they are easily spoofed. Android, with its signed apks has a distinct advantage here.
// Dont just copy/paste this code - that is what automated crackers look for - cludge it!
// No network communication is required at runtime.
// myPackageName should decode at runtime to "com.yourpackagename"
// google should decode at runtime to "com.android.vending";
// amazon should decode at runtime to "com.amazon.venezia";
public boolean scuttle(Context context, String myPackageName, String google, String amazon)
{
//Scallywags renamed your app?
if (context.getPackageName().compareTo(myPackageName != 0)
return true; // BOOM!
//Rogues relocated your app?
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;
}