question

Andy Ericksen avatar image
Andy Ericksen asked

API Key - assets/api_key.txt vs meta-data AmazonAPIKey

The docs say to place the API key in assets/api_key.txt but there are some examples where the API key is stored in a string resource instead and referenced in the manifest as: The meta-data method makes it a little easier when flipping between debug and release keys, it's the method I use and it seems to work just fine. 1. I can keep both debug and release keys in the strings resource file (api_key_debug/api_key_release) 2. I'm probably editing the manifest anyway to update the build number or version string 3. I don't have an extra text file (in a folder I rarely enter) that I forget to update and that can only contain one value (which makes me refer to another text file or the Amazon Developer Console to copy/paste the other key). Is there any reason not to use the meta-data method as opposed to the api_key.txt file? Will Amazon update the Docs to include the meta-data method?
amazon device messaging
10 |5000

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

Nick Gardner avatar image
Nick Gardner answered
Hi, Using the meta-data method is officially deprecated, so it may cease to work at an undetermined time in the future. Thus, we suggest using the api_key.txt method to ensure your app does not have issues in the future. Thanks for your feedback on this issue, we appreciate it and take it into account for future releases. Thanks, Nick
10 |5000

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

sluggo2112 avatar image
sluggo2112 answered
So the "assets" directory is where in Android Studio? ./app/build/intermediates/assets? Just asking since that's a generated build directory. I can't find any good documentation on this
10 |5000

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

Ben@AWS avatar image
Ben@AWS answered
If you are using Gradle to build your app, you can put a different api_key.txt asset by creating a folder structure like this: src/ --debug/assets/api_key.txt --release/assets/api_key.txt --main/.. your manifest etc.. --java/ .. your source code
10 |5000

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

sluggo2112 avatar image
sluggo2112 answered
Thanks I'll give that a try!
10 |5000

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

sluggo2112 avatar image
sluggo2112 answered
Yes that worked 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.