DigitalGoodsService not working after app installation, have to close the app and reopen to work
Describe the bug
After installation the DigitalGoodsService api is unavailable DigitalGoodsService error: OperationError: clientAppUnavailable clientAppUnavailable , i have to close the app and reopen to have access
iam executing this code
try {
const e = await window.getDigitalGoodsService("https://play.google.com/billing");
if (e) {
const s = await e.listPurchases();
console.log("Second verifications: ", s),
this.result = !0
}
} catch (e) {
console.error("DigitalGoodsService error:", e)
}
To Reproduce Steps to reproduce the behavior:
- Install an app that List purchases on first render
- Open the app after installation and crash
- Close the app and reopen <<- IT WORKS
- uninstall and repeat from step 1
Expected behavior Digital goods api should work after installation
Did this ever used to work IDK, first time using twa.
Screenshots
Smartphone (please complete the following information):
- Device: Pixel 8 Pro API 35 , and others phones
- OS: Android 15
- Browsers Installed Chrome
- Browser Versions 133.0.6943.21
- 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0' 'com.google.androidbrowserhelper:billing:1.0.0-alpha11'
Additional context Add any other context about the problem here.
Hi @fabiel-leon-autofact - were you ever able to resolve this issue? We seem to have it on first install as well. (although in our case we’re calling getDetails()).
Some of our own findings:
- Logcat includes this line:
05-08 11:00:17.789 512 512 W cr_DigitalGoods: Unable to execute getDetails.
This appears to be logged here: https://source.chromium.org/chromium/chromium/src/+/main:chrome/android/java/src/org/chromium/chrome/browser/browserservices/digitalgoods/DigitalGoodsAdapter.java;l=132-133;drc=467a8e68f685f9cfa47ee3fbfca20c22f7f6e893;bpv=0;bpt=0
PaymentRequest.show()still seems to work when this issue occurs.- asset-links appears to be set up correctly because the tab bar is not visible (and
window.getDigitalGoodsServicedoesn't throw; onlygetDetails)
Right now we’re considering building our own fallback API on our backend that uses the Google Play Developer API to implement the same functionality as getDetails. Though that obviously doesn't work for listPurchases.
hi , i was using this code to identify if the website is running inside the app, but it seems that is not intended for that, now im using a query parameter in the initial url when using the app and storing the result in sessionStorage , sessionStorage is keeped until you close the app and only the tab with the app keep the value, if you open the website in the browser it have his own sessionStorage and will not have that value
Also running into this issue. We were fine until I started the upgrade to the new billing api and with that, the new billing helper (1.0.1 -> 1.1.0).
I'm now consistently getting W cr_DigitalGoods: Unable to execute getDetails, which doesn't go away even upon restarting the app. Downgrading to our original setup (billingclient:billing:6.1.0) works ok, so still investigating what's going on at all.
@VesterDe FWIW we definitely had this issue pre 1.1.0. I'm pretty sure we observed it in 1.0.0-alpha11 too.