Identify which android market app is downloaded

Is it possible to identify if an apk is downloaded from Google Play or Amazone?

You can use Application.installerName

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; 
}