Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Which response code does in-app billing V3 return upon timeout?

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?

like image 971
class stacker Avatar asked Feb 05 '13 10:02

class stacker


People also ask

What does Google play in-app billing API version is less than 3 mean?

Usually the BILLING_UNAVAILABLE error means that your Android device is running an unsupported version of Android or Play services. Other things to check when you get this error: Are you logged in to the correct Google Account on the device/emulator? Try logging out and logging back in.

What is in-app billing API?

The server-side in-app billing API helps you define the status of a subscription when a user is signed into your another service.

What is billing in Android?

Google Play's billing system is a service that enables you to sell digital products and content in your Android app. You can use Google Play's billing system to sell a one-time product or subscriptions on a recurring basis.


1 Answers

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.

  • 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 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.
  • 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.

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.

like image 92
class stacker Avatar answered Oct 17 '22 22:10

class stacker