I am trying to configure my Android TV app (TVONOS) to support in-app subscriptions and use the appstore-billing-compatibility library. THe IAP for Google works OK, but for the Fire TV version I get errors on-startup (and things do not recover after that).
I have copied in file:
app/src/main/assets/AppstoreAuthenticationKey.pem
Attempt 1
2025-01-28 13:24:24.919 19148-19271 Kiwi com.deadlyduck.tvonos E CommandServiceClient: CommandServiceException happened, retriesLeft=6
com.amazon.a.a.n.a.a.c: COMMAND_SERVICE_NOT_INSTALLED: null: null
at com.amazon.a.a.n.a.d.e(CommandServiceClient.java:257)
at com.amazon.a.a.n.a.d.a(CommandServiceClient.java:181)
at com.amazon.a.a.n.a.a.a(AbstractCommandTask.java:124)
at com.amazon.a.a.n.c.b.f(TaskWorkflow.java:78)
at com.amazon.a.a.n.c.b.a(TaskWorkflow.java:49)
at com.amazon.a.a.n.b.b$1.run(SimpleTaskPipeline.java:179)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.os.HandlerThread.run(HandlerThread.java:67)
2025-01-28 13:24:24.958 19148-19148 Kiwi com.deadlyduck.tvonos E Appstore SDK - Production Mode: a: Received IOException while initializing JSON IAP provider.
2025-01-28 13:24:24.959 19148-19148 Kiwi com.deadlyduck.tvonos E Appstore SDK - Production Mode: a: Exception amazon.sdktester.json
2025-01-28 13:24:24.959 19148-19148 Kiwi com.deadlyduck.tvonos E Appstore SDK - Production Mode: c: Unable to get iap information provider to fetch parent term Sku map.
Attempt 2
After fining an article on stackoverflow I add the following to AndroidManifest.xml
2025-01-28 13:28:52.530 20056-20056 Kiwi com.deadlyduck.tvonos E Appstore SDK - Production Mode: a: Received IOException while initializing JSON IAP provider.
2025-01-28 13:28:52.531 20056-20056 Kiwi com.deadlyduck.tvonos E Appstore SDK - Production Mode: a: Exception amazon.sdktester.json
2025-01-28 13:28:52.531 20056-20056 Kiwi com.deadlyduck.tvonos E Appstore SDK - Production Mode: c: Unable to get iap information provider to fetch parent term Sku map.
2025-01-28 13:28:52.651 20056-20122 adlyduck.tvono com.deadlyduck.tvonos I Could not find corresponding native window for surface
2025-01-28 13:28:52.859 705-1238 Eve system_server E No event:ResumeAct data for App com.deadlyduck.tvonos
2025-01-28 13:28:53.695 20056-20122 adlyduck.tvono com.deadlyduck.tvonos I Could not find corresponding native window for surface
2025-01-28 13:28:55.237 17454-20050 AmazonApps...rityAction com.amazon.venezia E Content metadata not available for package name: com.deadlyduck.tvonos
2025-01-28 13:28:55.281 20056-20128 Kiwi com.deadlyduck.tvonos E AbstractCommandTask: On Exception!!!!: com.amazon.a.a.n.a.a.a: AUTH_TOKEN_VERIFICATION_FAILURE: null: null
Is this something that maybe someone can assist with as I really cannot see what I have done wrong in this case.
Thank you!
Thanks for the update; we are glad you were able to resolve the IOException. Regarding the AUTH_TOKEN_VERIFICATION_FAILURE error:
The condition causing the AUTH_TOKEN_VERIFICATION_FAILURE occurs when Appstore SDK is not able to verify the Authentication token sent from Amazon servers. This generally happens when the Public key (PEM file) is not available in the App.
The authentication token sent from Amazon server will be signed by the private key of that App when this Token reaches Appstore SDK it will try to use the Public key (PEM file) and verify the signature. This process is done to ensure that Appstore SDK only accepts data from Amazon authenticated servers, which have access to the private key.
Could you please double check it, by following the steps mentioned in Integrate the Appstore SDK | Appstore SDK to configure the key, and hopefully that resolves that issue. Normally, copying the public key (AppstoreAuthenticationKey.pem) to the assets folder is sufficient (please double check you got everything in correct location, etc).
have set up a Live App Testing version of your app through the developer console with the new DRM code using the Amazon SDK
installed the Live App Testing version through the Amazon Appstore app on the device
verified that the license result returned Success. Your app might fail because Amazon digitally signs the application when it is submitted
For testing purposes, your app has to be submitted to Appstore. If you are not going live with it yet, then it has to be at least in the beta environment (Live App Testing) of Appstore.
Finally, the most important step is to ensure that any obfuscator or code optimizer does not remove the required methods from your app. For that, please ensure you are following this guide: Obfuscate The App Code | In-App Purchasing
If the issue still happens again, even after following both (copying the PEM file and code obfuscation recommendation), please login to your Developer Portal account, and use Contact Us to send us the following details:
Thank you @Levon for your assistance. I now have it working!
(recording here in case anyone else hits this issue)
Going through all the documentation the solution I found was not obvious. (well not to me) The key to get it working for me was to update the proguard-rules.pro file to include:
-dontobfuscate
in addition to the data specified here:
It is mentioned in the next section in that document - but not as a required change.
Hi @Levon
Now that I have developed the app against the Amazon “Appstore Billing Compatibility SDK”. (other than the configuration part) coding against it was pretty good. However there was one thing that was a bit of a pain.
For the Purchase object I know that it does not support the Acknowledged parameter for the Purchase object (within Amazon), but the Google API does have a method call to check it: Purchase.isAcknowledged()
This is recommended to be called in the Google docs (to see if something is already ackowledged to prevent it being attempted again) - so is a fundamental part of the billing flow.
Would it be possible to mirror this method in the Amazon Purchase interface and just return false all the time?
I have currently had to do some nasty reflection in the code to see if the method exists before calling it.
It would be great if you could pass this request onto the Amazon development team?
Thanks, Rob
Thank you for the update. I’m glad I was able to help you resolve that error. Regarding the purchase acknowledgement, could you please check this and see if it’s helpful for your use case:
Or are you asking to have the exact same method signature (that is, to include an actual isAcknowledged() method in Amazon’s Appstore SDK)?
Yes exactly this. The best thing about the Amazon “Appstore Billing Compatibility SDK” is that you can drop it into your project and you don’t have to change any of the logic in the code needed to support the Google store. This method was the one exception - so having a “stub” for it would make adoption very smooth.