We are bringing an app to the Amazon appstore from Google Play. I know that we need to switch from Google's IAB to Amazon's In-App Purchasing API. But, for simplicity's sake, we'd like to leave the Google Play code in the binary so that we don't have to branch our source. To be clear, the Amazon version of the app would never take the Google Play IAB branch of code. Would we encounter any problems in submission if we go this route instead of actually commenting out or removing all Google Play IAB references?
We also would like to keep all the code in one place. How did you handle this? Specifically, wondering how you handle: 1) determining which in-app purchase methods to use, 2) determining which drm method to use Do you have separate Manifests and custom build scripts to produce separate binaries?
Here's one way to do it: 1) Check to see if the Amazon Appstore is present by calling the IAP method 'initiateGetUserIdRequest'. If the response returns successfully, you can use Amazon IAP. 2) Amazon provides a DRM method that works for all binaries purchased through Amazon. Since the DRM is applied during publishing, you don't have to be concerned with it if it is published through another store. 3) You should be able to use a single Manifest for both stores. I'm not sure what a custom build script would be needed for ... you should be able to build a single binary that addresses both paths.
Steve, Thanks for the response. Using initiateGetUserIdRequest as you suggested wouldn't necessarily mean our app was installed via Google Play, as the user could have both stores installed and may have purchased the app via Google Play, right? Is there another method of which you're aware? I did see some mention of checking Signatures of the app, but not sure this would work if we utilized the option to sign our app with our own signature. Thanks
If the app is downloaded from Amazon AppStore then you can assume that the AppStore is loaded on to the device & you should be using the Amazon IAP. In-case you downloaded the app from Amazon AppStore and try to purchase IAP using GooglePlay IAB, then we would reject it.
Anshul, My message above should say: Using initiateGetUserIdRequest as you suggested wouldn't necessarily mean our app was installed via __Amazon Appstore__, as the user could have both stores installed and may have purchased the app via Google Play, right? Is there another method of which you're aware? I did see some mention of checking Signatures of the app, but not sure this would work if we utilized the option to sign our app with our own signature. Does using initiateGetUserIdRequest as suggested guarantee the app was installed via the Appstore? I want to make sure that if our app was downloaded from Google Play, Amazon is not used for IAP. Message was edited by: qtoppler
The correct way to determine if an app is installed via Appstore in production mode is by using the onSdkAvailable(boolean isSandboxMode) method. Documentation on onSdkAvailable(boolean isSandboxMode) method from
https://developer.amazon.com/sdk/in-app-purchasing/documentation/developer-guide.html Abstract from documentation: onSdkAvailable(boolean isSandboxMode) - This callback is invoked once you register your PurchasingObserver with the PurchasingManager - This method tells you if the Purchasing Framework is running in sandbox mode with test data, or in production mode with real data - If your app is downloaded via the Amazon Client, isSandboxMode will return false - The initiating method should be called within the onStart() lifecycle method On registering your PurchaseObserver, you get a async call back, onSdkAvailable(Boolean isSanboxMode). If the app is downloaded via the Amazon Client then isSandboxMode will always return false. This code will work successfully in production mode, however in development/test environment, the isSandboxMode will always return true as the app is not downlaoded via the Amazon Client in test environment.
Anshul, Reading the documentation, it would seem this method merely returns whether or not the Appstore IAP SDK is available in sandbox or production, but not whether or not the app was actually purchased via Amazon's Appstore, or Google Play (the device could have access to both the Appstore and Google Play). Could you clarify? Thanks
The onSdkAvailable() documentation states that "If your app is downloaded via the Amazon Client, isSandboxMode will return false", so if you want to check if your app is downloaded from Amazon appstore, then please use the boolean value isSandboxMode. If the isSandboxMode returns false, then the app is downloaded from Appstore.
It looks like the latest version of the App Store actually supports getInstallerPackageName()! I'm on version release-5.0000.147.0C Amazon should return "com.aamazon.venezia" while Google should return "com.android.vending" and a sideloaded app will return null. Discovered here: