Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jonas Anthony Salcedo asked • 14 minutes agoActions Using IAP 2.0 in Live Testing/Migrating Fire App Builder AmazonInAppPurchaseComponent from 2.0 to Appstore SDK #84

Open
Jonas-Salcedo-On1y opened this issue Nov 4, 2023 · 0 comments

Comments

@Jonas-Salcedo-On1y
Copy link

My app was working perfectly when I just ran it in Android Studio Giraffe | 2022.3.1 Patch 2 and uploaded the following json file

{

"com.amazon.on1ynetwork.iap.twentyfourhour"
:{

"smallIconUrl"
:
"https://com-amazon-mas-catalog.s3.amazonaws.com/amzn1.devportal.assetupload.c218dbb6f85f44368ce602d32b8146dd_2ddd2f3d-590b-433c-a31c-6ea99f8d1c34_d69f5507b6f29943f4f382ac3556bb5d"
,
"title"
:
"24 Hour Pass"
,
"itemType"
:
"CONSUMABLE"
,
"price"
:
3.99
,
"description"
:
"A pass to watch all of On1y Network's content for a full 24 hours!"
,
"languageTitleMap"
:{

"US"
:
"24 Hour Pass"
},
"languageDescriptionMap"
:{

"US"
:
"A pass to watch all of On1y Network's content for a full 24 hours!"
},
"currencyPriceMap"
:{

"BR"
:
20.08
,
"DE"
:
3.77
,
"AU"
:
6.31
,
"IN"
:
331.81
,
"JP"
:
598.0
,
"MX"
:
72.67
,
"GB"
:
3.28
,
"IT"
:
3.77
,
"FR"
:
3.77
,
"US"
:
3.99
,
"ES"
:
3.77
,
"CA"
:
5.47
}},
"com.amazon.on1ynetwork.iap.subscription.monthly"
:{

"smallIconUrl"
:
"https://com-amazon-mas-catalog.s3.amazonaws.com/amzn1.devportal.assetupload.966a69874ed94825b7872190aa278efb_bb9b47fd-bfc9-4371-9605-608c2bb01726_9e6052ad82512677e68dc2be6efae28a"
,
"title"
:
"Subscription for On1y Network - Monthly"
,
"itemType"
:
"SUBSCRIPTION"
,
"price"
:
9.99
,
"description"
:
"A standard monthly subscription to On1y Network. You get access to all of On1y Network's content!"
,
"languageTitleMap"
:{

"US"
:
"Subscription for On1y Network - Monthly"
},
"languageDescriptionMap"
:{

"US"
:
"A standard monthly subscription to On1y Network. You get access to all of On1y Network's content!"
},
"currencyPriceMap"
:{

"US"
:
0.0
},
"subscriptionParent"
:
"com.amazon.on1ynetwork.iap.subscription"
,
"term"
:
"Monthly"
},
"daily"
:{

"smallIconUrl"
:
"https://com-amazon-mas-catalog.s3.amazonaws.com/amzn1.devportal.assetupload.bf8ffbdf34cf438ba5bb9d78c9ac63ae_18fa104b-1e90-41a4-9572-4d408f9e5480_28ef0b153bed97db32be99c09077c69b"
,
"title"
:
"24-hour Pass"
,
"itemType"
:
"CONSUMABLE"
,
"price"
:
3.99
,
"description"
:
"A daily pass to get access to all content from On1y Network."
,
"languageTitleMap"
:{

"US"
:
"24-hour Pass"
},
"languageDescriptionMap"
:{

"US"
:
"A daily pass to get access to all content from On1y Network."
},
"currencyPriceMap"
:{

"BR"
:
20.09
,
"DE"
:
3.77
,
"AU"
:
6.32
,
"IN"
:
331.94
,
"JP"
:
598.0
,
"MX"
:
72.77
,
"GB"
:
3.28
,
"IT"
:
3.77
,
"FR"
:
3.77
,
"US"
:
3.99
,
"ES"
:
3.77
,
"CA"
:
5.47
}},
"month"
:{

"smallIconUrl"
:
"https://com-amazon-mas-catalog.s3.amazonaws.com/amzn1.devportal.assetupload.f5ba4ccc3d5849de8e2c5f808ab2ef4d_6852e48f-32a1-4d66-929e-af4a9e23c082_ae47801373bdae3d8213c8929b112480"
,
"title"
:
"Monthly Subscription"
,
"itemType"
:
"SUBSCRIPTION"
,
"price"
:
9.99
,
"description"
:
"A monthly subscription to On1y Network where you get access to all our shows!"
,
"languageTitleMap"
:{

"US"
:
"Monthly Subscription"
},
"languageDescriptionMap"
:{

"US"
:
"A monthly subscription to On1y Network where you get access to all our shows!"
},
"currencyPriceMap"
:{

"US"
:
0.0
},
"subscriptionParent"
:
"monthly"
,
"term"
:
"Monthly"
}}

via

adb push amazon.sdktester.json /mnt/sdcard/

my skuslist is

{
"skusList": [
{
"sku": "monthly",
"productType": "SUBSCRIBE",
"purchaseSku": "monthly"
},
{
"sku": "daily",
"productType": "RENT",
"purchaseSku": "daily"
}
],
"actions": {
"CONTENT_ACTION_DAILY_PASS": "daily",
"CONTENT_ACTION_SUBSCRIPTION": "monthly"
}
}
However, when I tried this in Live Testing, when I clicked the Go Premium Button, I was able to purchase the subscription but not play back any videos. Every time I played back videos, the program just restarted.

So I tried changing my SDK in

C:\Users\jsalc\OneDrive\Desktop\GitCompliance\Updated-Fire-App-Builder\AmazonInAppPurchaseComponent\build.gradle

from

implementation files('libs/in-app-purchasing-2.0.61.jar')
to

implementation 'com.amazon.device:amazon-appstore-sdk:3.0.4'
because I learned that iap 2.0 was deprecated so I thought the problem was that I was using an outdated in-app-purchasing file so I switched over to the newer appstore sdk.

So I tried this and My app crashes every time I click Go Premium. I did some debugging and found that

PurchasingService.registerListener(mContext, iapListener);
returns an error of

com.amazon.a.a.o.a.b: Executing thread must be thread: 2, was: 2117

meaning the PurchasingLister does not register.

When I try to click Go Premium using the appstore sdk, I get

FATAL EXCEPTION: AsyncTask #2

Process: com.on1ynetwork.android.firetv.v1, PID: 8465

java.lang.RuntimeException: An error occurred while executing doInBackground()

at android.os.AsyncTask$3.done(AsyncTask.java:354)

at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)

at java.util.concurrent.FutureTask.setException(FutureTask.java:252)

at java.util.concurrent.FutureTask.run(FutureTask.java:271)

at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

at java.lang.Thread.run(Thread.java:764)

Caused by: java.lang.IllegalStateException: You must register a PurchasingListener before invoking this operation

at com.amazon.device.iap.internal.d.h(PurchasingManager.java:62)

at com.amazon.device.iap.internal.d.a(PurchasingManager.java:98)

at com.amazon.device.iap.PurchasingService.purchase(PurchasingService.java:123)

at com.amazon.inapppurchase.AmazonInAppPurchase.purchase(AmazonInAppPurchase.java:201)

at com.amazon.purchase.PurchaseAction.doInBackground(PurchaseAction.java:67)

at com.amazon.purchase.PurchaseAction.doInBackground(PurchaseAction.java:36)

at android.os.AsyncTask$2.call(AsyncTask.java:333)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

at java.lang.Thread.run(Thread.java:764)

2023-11-04 13:44:02.850 8465-8704 ModularApplication com.on1ynetwork.android.firetv.v1 E Uncaught Exception in thread Thread[AsyncTask #2,5,main]

java.lang.RuntimeException: An error occurred while executing doInBackground()

at android.os.AsyncTask$3.done(AsyncTask.java:354)

at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)

at java.util.concurrent.FutureTask.setException(FutureTask.java:252)

at java.util.concurrent.FutureTask.run(FutureTask.java:271)

at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)

at java.lang.Thread.run(Thread.java:764)

Caused by: java.lang.IllegalStateException: You must register a PurchasingListener before invoking this operation

at com.amazon.device.iap.internal.d.h(PurchasingManager.java:62)

at com.amazon.device.iap.internal.d.a(PurchasingManager.java:98)

at com.amazon.device.iap.PurchasingService.purchase(PurchasingService.java:123)

at com.amazon.inapppurchase.AmazonInAppPurchase.purchase(AmazonInAppPurchase.java:201)

at com.amazon.purchase.PurchaseAction.doInBackground(PurchaseAction.java:67)

at com.amazon.purchase.PurchaseAction.doInBackground(PurchaseAction.java:36)

at android.os.AsyncTask$2.call(AsyncTask.java:333)

I tried putting AppstoreAuthenticationKey.pem in app/src/main/assets

as well as the assets folders of PurchaseInterface and AmazonInAppPurchaseComponent and I still get the same result.

Anyway, is it possible to submit an app using the in-app-purchasing-2.0.61.jar and get it working in Live App Tester? If not, How do I migrate from that to amazon-appstore-3.0.4? Has anyone else encountered this issue?

The gradle version in my Fire App Builder project is upgraded from Gradle 7.6 to 8.4 and from Android Gradle Plugin 7.0.6 to 8.1.2. The Gradle Java Version is Jetbrains Runtime Version 17.0.6 I have also upgraded every module's build.gradle file from compileSdkVersion 23 to compileSdk 34 and every minSdkVersion that was minSdkVersion 21 or minSdkVersion 17 is now 28.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant