There are many similar Stackoverflow questions.
All have answers that suggest using methods like getInstallerPackageName
on the PackageManager
two binaries would be the most robust method but checking both the Build.MANUFACTURER and the installerName should get you pretty close (though assuming yo want to check for the Amazon AppStore if the user has installed an old version of the installer on their non-Kindle device and not updated the installerName might report null)
boolean isAmazonDevice = Build.MANUFACTURER.equalsIgnoreCase("amazon");
final Application application = getApplication();
String installerName = application.getPackageManager().getInstallerPackageName(application.getPackageName());
boolean fromAmazonStore = installerName != null && installerName.equalsIgnoreCase("com.amazon.venezia");
and then checking the value for:
isAmazonDevice || fromAmazonStore
should get you what you need for a significant amount of the time.
One scenario where this can confuse matters is if you are sideloading your apk for testing - in that case it wouldn't have the correct InstallerPackageName. You can fake that by sideloading the apk using:
adb install -i com.amazon.venezia APK_NAME