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?
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()
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.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 despite BILLING_RESPONSE_RESULT_ERROR
being described as a Fatal 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 like consumePurchase()
. Update: There's now evidence that getSkuDetails()
can access cached information within the local service, too.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.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.