question

sganem avatar image
sganem asked

Porting a Google Play app

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?
fire tabletsubmission testing distribution
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

StephenC@Amazon avatar image
StephenC@Amazon answered
Having both paths in the binary will not affect your submission or testing. Here's a support article you can use to help add Amazon IAP to your app: https://developer.amazon.com/sdk/in-app-purchasing/reference/google-to-iap.html
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

qtoppler avatar image
qtoppler answered
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?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

StephenC@Amazon avatar image
StephenC@Amazon answered
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.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

qtoppler avatar image
qtoppler answered
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
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Anshul@Amazon avatar image
Anshul@Amazon answered
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.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

qtoppler avatar image
qtoppler answered
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
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Anshul@Amazon avatar image
Anshul@Amazon answered
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.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

qtoppler avatar image
qtoppler answered
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
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Anshul@Amazon avatar image
Anshul@Amazon answered
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.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mttmllns avatar image
mttmllns answered
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: https://forums.developer.amazon.com/forums/thread.jspa?messageID=3679
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.