0

I'm using the google play billing library for in app purchases and right now I'm only destroying my BillingManager object in the onDestroy section of the activity from which it's instantiated (which is what the examples show). Does this mean that if the app is paused the billing manager keeps an open connection to play billing or does the billing manager automatically pause/resume itself based on the activity lifecycle? With Admob ads, I had to manually pause and resume them in the corresponding activity lifecycle methods which is why I wonder if the same thing needs to be done with the Billing Manager.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
spaceman
  • 118
  • 1
  • 2
  • 10

1 Answers1

1

What's for you the Billing Manager ?

I use a IInAppBillingService and a ServiceConnection, I do that just Google guidelines recommend and it runs fine. In onDestroy() the service is unBind.

onDestroy() is called when the Activity instance is destroyed, that means all non static data (fields) are destroyed and the Billing Service connection supposedly disconnected.

from56
  • 3,976
  • 2
  • 13
  • 23
  • I followed google's trivial drive v2 implementation and the BillingManager is the class that maintains a connection to the play store via the BillingClient class https://github.com/googlesamples/android-play-billing/blob/master/TrivialDrive_v2/shared-module/src/main/java/com/example/billingmodule/billing/BillingManager.java – spaceman Oct 23 '17 at 21:40
  • Essentially what I'm wondering is if the billing manager is connected to play billing until you call its .destroy() method in the onDestroy() method of your activity, is a connection maintained to play billing when the activity is paused but not destroyed? Can that leak resources and impact battery usage? – spaceman Oct 23 '17 at 21:57
  • I use this, much simpler : https://developer.android.com/google/play/billing/billing_integrate.html and I think it doesn't use resources in pause – from56 Oct 23 '17 at 22:01