Android: Which response code does in-app billing V3 return upon timeout?(Android:应用内计费 V3 超时返回哪个响应代码?)
问题描述
Google Play 应用内结算服务{ice,er} V3 将在网络超时条件下返回哪些响应状态代码?这是所有功能中的统一吗?
Which response status code(s) will the Google Play In-App Billing Serv{ice,er} V3 return upon a network timeout condition? Is this uniform amongst all of its functions?
推荐答案
我将在这里描述我的发现.我已经在安装了全功能 GP(GP Store V3.10.10、GP Services 2.0.12、G Services Framework 4.1.2)的 AVD 上测试了这一点,方法是拔掉主机的插头.
I will describe my findings here. I have tested this on an AVD with a fully featured GP installed (GP Store V3.10.10, GP Services 2.0.12, G Services Framework 4.1.2), by pulling the host's plug.
- 如果可能,
getPurchases()
方法会返回一个缓存的结果(请注意,我们不是谈论的是服务之外的缓存 这里只是直接调用 getPurchases).当然,这意味着几乎总是会得到一个缓存的结果,除非由于本地数据丢失而重新初始化服务 - 这种情况不太可能并且通常不需要在应用级别. consumePurchase()
方法将在假定的内部网络超时 20 秒后返回整数值 6 (BILLING_RESPONSE_RESULT_ERROR
)(所以在结果之前增加一点时间代码被调用者看到).尽管BILLING_RESPONSE_RESULT_ERROR
被描述为API 操作期间的致命错误
,但我还是怀疑这一点,因为这里没有其他错误代码有意义;不幸的是,fatal 这个词对于诸如超时之类的临时情况来说仍然有些不合适.getSkuDetails()
的行为似乎与consumePurchase()
类似.更新:现在有证据表明getSkuDetails()
也可以访问本地服务中的缓存信息.- 如果服务已经知道该项目,那么看起来
getBuyIntent()
在没有连接的情况下也能正常工作.这解释了 Hartok 看到空白 GP 购买屏幕的原因:在没有连接的情况下从 IAB V3 获得购买意图不是问题.
- The
getPurchases()
method returns a cached result if possible (please note that we're not talking about a cache outside of the Service here but a direct call of getPurchases). Of course, this means that one will almost always get a cached result except when the Service is being re-initialized due to the loss of local data -- a case which is not very likely and often needs not be treated in special ways on the application level. - The
consumePurchase()
method will return the integer value 6 (BILLING_RESPONSE_RESULT_ERROR
) after a presumed internal net timeout of 20 seconds (so add a bit of time until the result code is seen by the caller). I was suspecting this despiteBILLING_RESPONSE_RESULT_ERROR
being described as aFatal error during the API action
because no other error code would make sense here; unfortunately, the word fatal is still somewhat inappropriate for a temporary condition such as a timeout. getSkuDetails()
appears to behave just likeconsumePurchase()
. Update: There's now evidence thatgetSkuDetails()
can access cached information within the local service, too.- It looks as if
getBuyIntent()
works fine without connectivity if the item is already known to the service. This explains why Hartok sees a blank GP purchase screen: It's not a problem to get a buy intent from the IAB V3 without connectivity.
结论:In-App Billing Service V3 似乎可以使用内部缓存和 20 秒的服务器连接超时.对于本地缓存无法解决的服务器通信错误,使用响应代码 6.
Conclusion: The In-App Billing Service V3 appears to work with an internal cache and a server connection timeout of 20 seconds. For server communication errors which the local cache cannot resolve, response code 6 is used.
这篇关于Android:应用内计费 V3 超时返回哪个响应代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Android:应用内计费 V3 超时返回哪个响应代码?
基础教程推荐
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01