Amazon Mobile App Distribution Home » Forums » Kindle Fire » Submission, Testing & Distribution

Thread: Porting a Google Play app


Permlink Replies: 11 - Pages: 1 - Last Post: Jun 1, 2013 12:59 PM by: Sujoy@Amazon Threads: [ Previous | Next ]
sganem

Posts: 1
Registered: 9/10/12
Porting a Google Play app
Posted: Sep 10, 2012 12:17 PM

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?

StephenC@Amazon

Posts: 102
Registered: 8/1/12
Re: Porting a Google Play app
Posted: Sep 11, 2012 11:29 AM   in response to: sganem

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

qtoppler

Posts: 28
Registered: 10/5/12
Re: Porting a Google Play app
Posted: Oct 5, 2012 1:16 PM   in response to: sganem

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?

StephenC@Amazon

Posts: 102
Registered: 8/1/12
Re: Porting a Google Play app
Posted: Oct 7, 2012 11:04 PM   in response to: qtoppler

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.

qtoppler

Posts: 28
Registered: 10/5/12
Re: Porting a Google Play app
Posted: Oct 8, 2012 12:09 PM   in response to: qtoppler

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

Anshul@Amazon

Posts: 174
Registered: 8/6/12
Re: Porting a Google Play app
Posted: Oct 10, 2012 5:33 AM   in response to: qtoppler

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.

qtoppler

Posts: 28
Registered: 10/5/12
Re: Porting a Google Play app
Posted: Oct 10, 2012 5:14 PM   in response to: Anshul@Amazon

Anshul,
My message above should say:
<begin>
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.
<end>

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

Anshul@Amazon

Posts: 174
Registered: 8/6/12
Re: Porting a Google Play app
Posted: Oct 11, 2012 11:59 PM   in response to: 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.

qtoppler

Posts: 28
Registered: 10/5/12
Re: Porting a Google Play app
Posted: Oct 17, 2012 11:00 AM   in response to: Anshul@Amazon

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

Anshul@Amazon

Posts: 174
Registered: 8/6/12
Re: Porting a Google Play app
Posted: Oct 18, 2012 12:01 AM   in response to: qtoppler

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.

mttmllns

Posts: 3
Registered: 3/11/13
Re: Porting a Google Play app
Posted: May 31, 2013 10:55 AM   in response to: sganem

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

Sujoy@Amazon

Posts: 1,915
From: Bangalore
Registered: 3/12/13
Re: Porting a Google Play app
Posted: Jun 1, 2013 12:59 PM   in response to: mttmllns

Hi Mttmllns,

Thank you for your post. Yes, it has been fixed in the latest version of App Store.

Legend
Ace: 2000 + pts
Expert: 750 - 1999 pts
Guide: 300 - 749 pts
Enthusiast: 50 - 299 pts
Newbie: 5 - 49 pts
Amazonian
Helpful Answer (5 pts)
Correct Answer (10 pts)