question

Skurry avatar image
Skurry asked

Which api_key.txt to add in release build?

Hi, I'm still a bit unclear on how to submit my app so that GameCircle authentication works properly. As I understand it, Amazon will replace the app signature with their own, and overwrite the api_key.txt so that it will match that certificate. Do I still need to submit the app with an api_key.txt that matches my release certificate? Will the testers run exactly the APK that I'm submitting, or will it run through the Amazon pre-processor first? My submission just failed testing because GameCircle can't initialize, and I'm trying to understand what went wrong. A bit of feedback: The api_key.txt is quite inconvenient. I need to create one file per development machine (different debug certificate stores) and when I'm compiling a release APK, remember to swap it out for the release api_key.txt? There has to be a better solution! Google seems to manage this fine, without a client side secret. 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.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Skurry, You should keep the api key associated with your release certificate while submitting the new versions in the developer console. Since your release cert will never change, so you do not need to create the api key again and again. So keeping the release version of your api_key.txt will be good option. For development, you need to add set of API keys for different developer machines. And each developer should maintain their own key in the asset folder in the project. You are correct that the API key would be replaced with the one that is associated with the certificate we use to sign your apk before distributing the version through app store. Our tester also takes the version which is having the replaced API key. Now you can ask that why do you need to keep an API key inside the apk you submit to us since we ultimately replace it. That might be needed to test or trouble shoot issues in the apk you have submitted to us. Does it make sense?
10 |5000

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

Skurry avatar image
Skurry answered
Yes that makes sense, it's just a little inconvenient to have to remember to switch out the api_key.txt when building a release version. One thing that puzzles me though is why my app failed testing: "1. Install and Launch the app 2. Tap on Game Circle buttons, no functionality is performed." The only scenario I can think of is if GameCircle can't initialize. I submitted that version with my debug api_key.txt, but from what you're saying, that shouldn't be an issue because your build process replaces that? I now built a new version with the release api_key.txt, hope that'll work. Another question: When I look at my security profile, I now see an entry that I haven't created myself, where the name is the package name of my app. Is that the security profile that gets put into the final public version of the APK? 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.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Skurry, Can you please raise a ContactUs ( https://developer.amazon.com/help/contactus.html) from the developer account and provide the app details so that we can take a deeper look on the issue? The issue you are being reported in the submitted version, seems like to little wired. Please mention about this thread url in the case you are going to create so that you do not need to explain the issue in detail. 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.

Skurry avatar image
Skurry answered
Thanks Sujoy, I'll do that. Regarding the smaller issue with multiple keys, I discovered that it seems to be possible to put multiple keys into the api_key.txt file, one per line. Can you confirm that this is how it's supposed to work? That would make my life much easier. Thanks again!
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
No. API key file can take only one key. If you put multiple api keys in several lines you should be receiving invalid api key error.
10 |5000

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

Skurry avatar image
Skurry answered
Ok. I must not have rebuilt the app fully, because it appeared to be working. But you're right, it's not. Still struggling with intermittent "CANNOT_INITIALIZE" callbacks when trying to initialize GameCircle. I opened a "Contact Us" request. In the meantime, in other posts I saw that there's a sample GameCircle implementation? Is that downloadable somewhere? Maybe I can see what I could do better.
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Received your ContactUs. I will look into it and get back to you. Mean while I have sent you the sample to your registered mail id. Please check.
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Skurry, I have replied to your case. The problem could be that you are calling AmazonGamesClient.initialize() from a different thread. The recommended way of doing this is from onResume of your main activity. public void onResume() { super.onResume(); AmazonGamesClient.initialize(this, callback, myGameFeatures); } Please follow below documentation for initialization guideline of GameCircle https://developer.amazon.com/public/apis/engage/gamecircle/docs/initialize-android
10 |5000

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

hneilk avatar image
hneilk answered
I have a related question. If I want to submit my game to both the Amazon app store and Google Play, should I use the release MD5 signature to generate an API key and include that in the api_key.txt file? Do I then also need to sign the app myself instead of letting Amazon sign it, so the key isn't changed, or is it OK for there to be two separate API keys for the same MD5 signature and package name?
10 |5000

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

Sujoy@Amazon avatar image
Sujoy@Amazon answered
You should use same api key for both the apk for two stores. For Google play, your app will use the same your are putting asset folder. For Amazon app store, your app is going to be signed with Amazon's signature. So the apk which will distributed through Amazon App Store, that will contain the api key associated with Amazon's signature. Both the API keys are supposed work together. Please make sure that your app is linked correctly with the same security profile in developer console account. 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.