Amazon App Store IAP Implementation throws CommandServiceClient: CommandServiceException at runtime

Viewed 483

I'm getting some runtime errors when trying to connect to the Appstore SDK in sandbox mode from a Samsung Device:

D/Kiwi: CommandServiceClient: Binding Service!!!
D/Kiwi: CommandServiceClient: Created intent with  action  com.amazon.venezia.CommandService
E/Kiwi: CommandServiceClient: CommandServiceException happened, retriesLeft=4
    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.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:246)
        at android.os.HandlerThread.run(HandlerThread.java:67)
D/Kiwi: CommandServiceClient: Sleeping for 400 ms
I/ViewRootImpl@4ec0c94[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@f7f1bd[MainActivity]
D/InputMethodManager: getNavigationBarColor() -855310
D/FA: Connected to remote service
D/InputMethodManager: prepareNavigationBarInfo() DecorView@f7f1bd[MainActivity]
D/InputMethodManager: getNavigationBarColor() -855310
mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
V/FA: Processing queued up service tasks: 7
D/InputTransport: Input channel constructed: 'ClientS', fd=202
D/InputMethodManager: prepareNavigationBarInfo() DecorView@f7f1bd[MainActivity]
D/InputMethodManager: getNavigationBarColor() -855310
 mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/SurfaceControl: nativeRelease nativeObject s[-5476376664434943808]
I/SurfaceControl: nativeRelease nativeObject e[-5476376664434943808]
I/SurfaceControl: nativeRelease nativeObject s[-5476376664434943904]
I/SurfaceControl: nativeRelease nativeObject e[-5476376664434943904]
W/FlurryAgent: Analytics report sent to https://data.flurry.com/v1/flr.do
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
I/Ads: Ad failed to load : 3
D/MyAds: No ad config.
I/Ads: Ad failed to load : 3
AllocSpace objects, 2(104KB) LOS objects, 49% free, 7073KB/13MB, paused 212us total 103.640ms
D/FONTSIZE: letter=50specials:36
D/TAG: tileWidth=72.0
I/TAG: No ad config.
I/Ads: Ad failed to load : 3
D/Kiwi: CommandServiceClient: Binding Service!!!
D/Kiwi: CommandServiceClient: Created intent with  action  com.amazon.venezia.CommandService
E/Kiwi: CommandServiceClient: CommandServiceException happened, retriesLeft=3
    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.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:246)
        at android.os.HandlerThread.run(HandlerThread.java:67)
D/Kiwi: CommandServiceClient: Sleeping for 800 ms
W/FlurryAgent: Analytics report sent to https://data.flurry.com/v1/flr.do
D/Kiwi: CommandServiceClient: Binding Service!!!
D/Kiwi: CommandServiceClient: Created intent with  action  com.amazon.venezia.CommandService
E/Kiwi: CommandServiceClient: CommandServiceException happened, retriesLeft=2
    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.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:246)
        at android.os.HandlerThread.run(HandlerThread.java:67)
D/Kiwi: CommandServiceClient: Sleeping for 1600 ms
D/Kiwi: CommandServiceClient: Binding Service!!!
D/Kiwi: CommandServiceClient: Created intent with  action  com.amazon.venezia.CommandService
E/Kiwi: CommandServiceClient: CommandServiceException happened, retriesLeft=1
    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.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:246)
        at android.os.HandlerThread.run(HandlerThread.java:67)
D/Kiwi: CommandServiceClient: Sleeping for 3200 ms
V/FA: Inactivity, disconnecting from the service
D/Kiwi: CommandServiceClient: Binding Service!!!
D/Kiwi: CommandServiceClient: Created intent with  action  com.amazon.venezia.CommandService

When trying to get the user data but the request never returns on Sandbox.

D/d: Appstore SDK - Sandbox Mode: sendGetUserDataRequest
D/d: Appstore SDK - Sandbox Mode: sendPurchaseUpdatesRequest/sendGetUserData first:a3c3a5b3-d45d-4a0d-9ba7-6bb7c3075bba
D/d: Appstore SDK - Sandbox Mode: sendItemDataRequest

When running against the production servers I get a "FAILED" status when trying to get IAP product information available like price name etc.

I have their Amazon App Tester app installed and it recognizes the local json I've uploaded.

Does it look like a broken linking maybe or Pro guard invalid config file ? I'm a beginner on Android development , was able to implement Play Store IAP's sucessufully in the past but seems I'm missing something regarding the Amazon Store IAP.

3 Answers

Since API 30 you need to add queries to the manifest file. For Amazon this is needed:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    ...>
    <queries>
        <package android:name="com.amazon.venezia"/>
    </queries>

It's really weird that they didn't write that in their documentation.

Thanks a lot, Simon ! I've included the queries part like this:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.mycompany.myapp">

    <queries>
        <package android:name="com.amazon.venezia"/>
    </queries>
    <uses-feature
        android:name="android.hardware.camera"
        android:required="true" />

But I still get the command service not installed error:

> D/Kiwi: AbstractCommandTask: ----------------------------------------------
D/Kiwi: AbstractCommandTask: Executing: get_license
D/Kiwi: AbstractCommandTask: ----------------------------------------------
D/Kiwi: AbstractCommandTask: Executing Command: get_license
D/Kiwi: CommandServiceClient: Binding Service!!!
D/Kiwi: CommandServiceClient: Created intent with  action  com.amazon.venezia.CommandService
E/Kiwi: 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.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.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.os.HandlerThread.run(HandlerThread.java:67)

When running agains Production. When using Sandbox mode, I don't get anymore COMMAND_SERVICE_NOT_INSTALLED but I do get AUTH_TOKEN_VERIFICATION_FAILURE:

> D/Kiwi: AbstractCommandTask: Exception occurred while processing task: com.amazon.a.a.n.a.a.a: AUTH_TOKEN_VERIFICATION_FAILURE: null: null
    com.amazon.a.a.n.a.a.a: AUTH_TOKEN_VERIFICATION_FAILURE: null: null
        at com.amazon.a.a.n.a.b.a(AuthenticationTokenVerifier.java:94)
        at com.amazon.a.a.n.a.a.a(AbstractCommandTask.java:204)
        at com.amazon.a.a.n.a.a.a(AbstractCommandTask.java:131)
        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:246)
        at android.os.HandlerThread.run(HandlerThread.java:67)
E/Kiwi: AbstractCommandTask: On Exception!!!!: com.amazon.a.a.n.a.a.a: AUTH_TOKEN_VERIFICATION_FAILURE: null: null

I've included the .pem file as they suggested in the project's assets directory but it seems it didn't work:

AppstoreAuthenticationKey.pem

Do you have any clue of what might be the issue ?

Related