Skip to content

Instantly share code, notes, and snippets.

@isaidamier
Created September 4, 2019 22:21
Show Gist options
  • Save isaidamier/925af0a4fefecda4c2b97d814f4b387b to your computer and use it in GitHub Desktop.
Save isaidamier/925af0a4fefecda4c2b97d814f4b387b to your computer and use it in GitHub Desktop.
private fun instantiateAndConnectToPlayBillingService() {
playStoreBillingClient = BillingClient.newBuilder(application.applicationContext)
.enablePendingPurchases() // required or app will crash
.setListener(this).build()
connectToPlayBillingService()
}
private fun connectToPlayBillingService(): Boolean {
Log.d(LOG_TAG, "connectToPlayBillingService")
if (!playStoreBillingClient.isReady) {
playStoreBillingClient.startConnection(this)
return true
}
return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment