Giter Club home page Giter Club logo

rxbilling's Introduction

RxBilling

RxBilling is a simple wrapper above Google Billing library with connection management

Download

implementation 'com.github.betterme-dev:RxBilling:$latestVersion'
implementation 'com.android.billingclient:billing:$billingClientVer'

How to use

Connection management

BillingConnectionManager

The entry point to Billing connection management is BillingConnectionManager, that connect and disconnect in onStart() / onStop() callbacks of your LifecycleOwner

Add next lines to your Activity, Fragment or any other lifecycle owner

class MainActivity : AppCompatActivity() {

    private lateinit var rxBilling: RxBilling

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        rxBilling = RxBillingImpl(BillingClientFactory(applicationContext))
        lifecycle.addObserver(BillingConnectionManager(rxBilling))
    }
}

Retry / Repeat connection

The default implementation of retry transformation is RepeatConnectionTransformer().

You can provide your own transformer to BillingClientFactory and BillingServiceFactory

val clientFactory = BillingClientFactory(this, FlowableTransformer { upstream ->
    upstream.retry(2)
})

Observe Billing updates

override fun onStart() {
    super.onStart()
    disposable.add(
            rxBilling.observeUpdates()
            .subscribe({
                //handle update here
            }, {
                //handle error
            })
    )
}

override fun onStop() {
    disposable.clear()
    super.onStop()
}

Launch Billing flow

The result of this operation will be delivered to your updates observer

private fun startFlowWithClient() {
       disposable.add(rxBilling.launchFlow(this, BillingFlowParams.newBuilder()
               .setSkuDetails(SkuDetails) // see ## Load sku details
               .setType(BillingClient.SkuType.SUBS)
               .build())
               .subscribe({
                   //flow started
               }, {
                  //handle error
               }))
    }

Load owned products

private fun loadPurchases() {
     disposable.add(rxBilling.getPurchases(BillingClient.SkuType.INAPP)
              .subscribe({
                  //handle purchases
              }, {
                  //handle error
              }))
}

Load owned purchases

private fun loadPurchases() {
    disposable.add(
            rxBilling.getPurchases(BillingClient.SkuType.SUBS)
                    .subscribe({
                        Timber.d("getPurchases $it")
                        tvPurchases.text = it.toString()
                    }, {
                        Timber.e(it)
                    }))
}

Load history

private fun loadHistory() {
    disposable.add(
            rxBilling.getPurchaseHistory(BillingClient.SkuType.SUBS)
                    .subscribe({
                        Timber.d("getPurchaseHistory $it")
                        tvHistory.text = it.toString()
                    }, {
                        Timber.e(it)
                    }))
}

Load sku details

private fun loadDetails() {
    disposable.add(
            rxBilling.getSkuDetails(
                    SkuDetailsParams.newBuilder()
                            .setSkusList(listOf("your_id1", "your_id2"))
                            .setType(BillingClient.SkuType.SUBS)
                            .build())
                    .subscribe({
                        Timber.d("loadDetails $it")
                        tvDetails.text = it.toString()
                    }, {
                        Timber.e(it)
                    }))
}

Consume product

private fun consume() {
    disposable.add(
            rxBilling.consumeProduct(
                    ConsumeParams.newBuilder()
                            .setPurchaseToken("token")
                            .build())
                    .subscribe()
    )
}

Acknowledge item

private fun acknowledge() {
    disposable.add(
            rxBilling.acknowledge(
                    AcknowledgePurchaseParams.newBuilder()
                            .setPurchaseToken("token")
                            .build())
                    .subscribe({
                        Timber.d("acknowledge success")
                    }, {
                        Timber.e(it)
                    }))
}

rxbilling's People

Contributors

constmikhailovskiy avatar dima-ostapovets avatar dmytro-ostapovets avatar kchernenko avatar mrstif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rxbilling's Issues

BillingClient 2+ isn't working

I'am using the lib with billingclient 1.2.2 and i have no probleme.
But when i try to upgrade it to 2.2.0 our 3.0.0 i got this error : Failed resolution of: Lcom/android/vending/billing/IInAppBillingService$Stub;
It's seem that google removed it, are you working on fixing it ?

[q] billing client 2.1.x support

Wanted to upgrade my app to Android billing client 2.1.x
Is that possible, or should I wait for an updated release of rxBilling?

Asking because
according to this
https://developer.android.com/google/play/billing/billing_library_overview
there is a specific kotlin module that would need to be linked in
(our app is Java, does not use Kotlin, but I know that rxBilling uses it underneath)

"If you're using Kotlin, the Play Billing Library KTX module contains Kotlin extensions and coroutines support that enable you to write idiomatic Kotlin in your Play Billing solution. To include these extensions in your project, add the following dependencies to your app's build.gradle file: "

RxBilling 3.0.0 unavailable on Maven

Trying to update to the latest v3.0.0, I get this error output from gradle:

Could not determine the dependencies of task ':app:compileDebugKotlin'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.betterme:rxbilling:3.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/betterme/rxbilling/3.0.0/rxbilling-3.0.0.pom
       - https://jcenter.bintray.com/com/betterme/rxbilling/3.0.0/rxbilling-3.0.0.pom
       - https://jitpack.io/com/betterme/rxbilling/3.0.0/rxbilling-3.0.0.pom
       - https://maven.google.com/com/betterme/rxbilling/3.0.0/rxbilling-3.0.0.pom
       - https://repo.maven.apache.org/maven2/com/betterme/rxbilling/3.0.0/rxbilling-3.0.0.pom

The package doesn't seem to be available through the web interface either: https://mvnrepository.com/artifact/com.betterme/rxbilling

blockingGet

Hello,
Thank you for making this library available. It is much easier to use than the mess suggested in the android example.

I am trying to using blockingGet with rxBilling, but receiving either timeout (if using a non-main thread), or getting blocked when using a Main thread.



 List<SkuDetails> lstSkuDetails =
                 rxBilling.getPurchaseSkuDetails(mySkus)
                .timeout(10, TimeUnit.SECONDS, AndroidSchedulers.from(Looper.getMainLooper()))  //also tried other schedulers eg AndroidSchedulers.mainThread()  and tried io threads
                .blockingGet();

I cannot figure out a way to get this to work.

Reason, I wanted to use blocking, because I have a function that requires both
SkuDetails and Purchases
eg: myRenderFun(SkuDetails dtl, Purchase purch).

For that reason, I was trying to build a 'join' in a way, first use blockingGet to get the SKudetails, and for each skuDetail, I invoked a ansynch call to get purchases, and then I had both pieces. I needed.

I searched this repository for example of blockingGet, as well as your article at
https://dou.ua/lenta/articles/rxbilling-library/

But could not find, if this is even supported.
So wanted to check.

Thank you in advance.

Problem with Handle Billing result with RxBillingFlow

in this method :

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        disposable.add(
            rxBillingFlow.handleActivityResult(data)
                .subscribe({
                    Timber.d("onActivityResult $it")
                    tvServiceFlow.text = it.toString()
                }, {
                    Timber.e(it)
                    tvServiceFlow.text = it.toString()
                }))
    }

handleActivityResult need int not intent, how to fix it ?

API 22 support

Hello,
I am testing my app on API 22.
And at least in the emulator, without Billing API installed, I am getting a hard crash.
Cannot even debug where this is happening, my app just restarts.

I see that, I correctly get a callback saying that there was a connection error.
I set my internal flags to indicate that there was an error.
Then I am not doing anything (essentially my fragment display a TextView saying, please sing in to Google Play).

But system crashes anyways with

--------- beginning of system
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage: com.gen.rxbilling.exception.BillingException$BillingUnavailableException: Billing error, code 3
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.gen.rxbilling.connection.BillingServiceFactory$createConnection$flowable$1.subscribe(BillingServiceFactory.kt:53)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.internal.operators.flowable.FlowableCreate.subscribeActual(FlowableCreate.java:71)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14805)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14752)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at hu.akarnokd.rxjava2.debug.FlowableOnAssembly.subscribeActual(FlowableOnAssembly.java:46)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14805)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.internal.operators.flowable.FlowablePublish.connect(FlowablePublish.java:130)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at hu.akarnokd.rxjava2.debug.FlowableOnAssemblyConnectable.connect(FlowableOnAssemblyConnectable.java:54)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.internal.operators.flowable.FlowableRefCount.subscribeActual(FlowableRefCount.java:91)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14805)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14752)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at hu.akarnokd.rxjava2.debug.FlowableOnAssembly.subscribeActual(FlowableOnAssembly.java:46)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14805)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14752)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.internal.operators.flowable.FlowableRepeat$RepeatSubscriber.subscribeNext(FlowableRepeat.java:101)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.internal.operators.flowable.FlowableRepeat.subscribeActual(FlowableRepeat.java:36)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14805)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14752)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at hu.akarnokd.rxjava2.debug.FlowableOnAssembly.subscribeActual(FlowableOnAssembly.java:46)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14805)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.internal.operators.flowable.FlowableReplay.connect(FlowableReplay.java:229)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at hu.akarnokd.rxjava2.debug.FlowableOnAssemblyConnectable.connect(FlowableOnAssemblyConnectable.java:54)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.internal.operators.flowable.FlowableRefCount.subscribeActual(FlowableRefCount.java:91)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14805)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14752)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at hu.akarnokd.rxjava2.debug.FlowableOnAssembly.subscribeActual(FlowableOnAssembly.java:46)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14805)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14752)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at hu.akarnokd.rxjava2.debug.FlowableOnAssembly.subscribeActual(FlowableOnAssembly.java:46)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14805)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14742)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at io.reactivex.Flowable.subscribe(Flowable.java:14696)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.gen.rxbilling.lifecycle.androidx.BillingConnectionManager.connect(BillingConnectionManager.kt:19)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.gen.rxbilling.lifecycle.androidx.BillingConnectionManager_LifecycleAdapter.callMethods(BillingConnectionManager_LifecycleAdapter.java:25)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.lifecycle.SingleGeneratedAdapterObserver.onStateChanged(SingleGeneratedAdapterObserver.java:29)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:361)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:300)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:339)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:145)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:131)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.Fragment.performStart(Fragment.java:2590)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:918)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1235)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1301)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2620)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.dispatchStart(FragmentManagerImpl.java:2586)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.Fragment.performStart(Fragment.java:2588)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:918)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1235)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1301)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:710)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2071)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1861)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1816)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentManagerImpl.execSingleAction(FragmentManagerImpl.java:1693)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:560)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.fragment.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:148)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1244)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:669)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:631)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at androidx.viewpager.widget.ViewPager.setCurrentItem(ViewPager.java:612)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.google.android.material.tabs.TabLayout$ViewPagerOnTabSelectedListener.onTabSelected(TabLayout.java:2831)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.google.android.material.tabs.TabLayout.dispatchTabSelected(TabLayout.java:1608)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.google.android.material.tabs.TabLayout.selectTab(TabLayout.java:1601)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.google.android.material.tabs.TabLayout.selectTab(TabLayout.java:1569)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.google.android.material.tabs.TabLayout$Tab.select(TabLayout.java:1874)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.google.android.material.tabs.TabLayout$TabView.performClick(TabLayout.java:2059)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at android.view.View$PerformClick.run(View.java:19866)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at android.os.Handler.handleCallback(Handler.java:739)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at android.os.Handler.dispatchMessage(Handler.java:95)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at android.os.Looper.loop(Looper.java:135)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at android.app.ActivityThread.main(ActivityThread.java:5254)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at java.lang.reflect.Method.invoke(Native Method)
05-02 00:22:40.458 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at java.lang.reflect.Method.invoke(Method.java:372)
05-02 00:22:40.459 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
05-02 00:22:40.459 3686-3686/com.myapp1.develop E/BillingConnectionManage:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
05-02 00:22:40.459 3686-3686/com.myapp1.develop E/BillingConnectionManage: Caused by: hu.akarnokd.rxjava2.debug.RxJavaAssemblyException
05-02 00:22:40.459 3686-3686/com.myapp1.develop E/BillingConnectionManage: Caused by: hu.akarnokd.rxjava2.debug.RxJavaAssemblyException
05-02 00:22:40.459 3686-3686/com.myapp1.develop E/BillingConnectionManage: Caused by: hu.akarnokd.rxjava2.debug.RxJavaAssemblyException
05-02 00:22:40.459 3686-3686/com.myapp1.develop E/BillingConnectionManage: Caused by: hu.akarnokd.rxjava2.debug.RxJavaAssemblyException
05-02 00:22:40.459 3686-3686/com.myapp1.develop E/BillingConnectionManage: Caused by: hu.akarnokd.rxjava2.debug.RxJavaAssemblyException
05-02 00:22:40.459 3686-3686/com.myapp1.develop E/BillingConnectionManage: Caused by: hu.akarnokd.rxjava2.debug.RxJavaAssemblyException
05-02 00:22:40.459 3686-3686/com.myapp1.develop E/BillingConnectionManage: Caused by: hu.akarnokd.rxjava2.debug.RxJavaAssemblyException

"05-02 00:09:08.009 4757-4757/com.myapp1.develop W/System.err: at java.lang.Throwable.printStackTrace(Throwable.java:349)

code that caches the billing api connectivity error (notice, that observeUpdate subscription still happens
even if there was a connectivity error... but I disabled that in one of my tries, and it did not help)

Could there be an issue with lifecycle management and rxBilling observer itself?
in API Level 22 (on 24 or 27 this particular error does not happen)

Minor Update 1: I think this problem relates to
JakeWharton/timber#282
Somewhere in rxBilling code, Timber is used to print exception (which is probably Google's Billing API connection error).
The Billing APIs have big Exception messages with lots of causes...
In APIs 22 and below (may be due to dalvik's stack management), this is caused this massive problem.

Reason I am suspecting this, because I also use Timber and when Timber.e is used
in rx onError callbacks, it is causing this problem that eventually crashes the program (in my case when Retrofit causes rx error callbacks (and Retrofit exceptions also have lots of causes) ).

Not sure yet, where exactly in rxBilling the call to Timber with the Billing exception, is happening... so just a guess at the moment.
** end of minor update 1**

@Override
    public void onStart() {
        super.onStart();


        disposable.add( rxBilling.connect()
                .subscribe(( res )-> {
                    this.bIsBillingConnected.set(true);
                        },
                        (err)-> {
                            this.bIsBillingConnected.set(false);
                        }
                ));

        disposable.add(rxBilling.observeUpdates()
                .subscribe((/*PurchasesUpdate*/ it) -> {

                            final String x = it.toString();
                            Timber.d(TAG + "::observeUpdates %s", it.toString());
                            if (getView()!= null) {
                                invalidateState__UiFresh();
                                render();
                            }
                            if (it.getCode()== LCPurchRC.OK) {
                               //do my work here
                            }
                            else {
                                displayPurchError(it.getCode());
                            }
                        },
                        (err) -> {
                            Timber.e(err);
                        }
                )
        );
    }

Google Play In-app Billing API version is less than 3

Hello
just upgraded to 2.0.0 of rxbilling

When running on emulator (API Q with google play) I am seeing
this

" Google Play In-app Billing API version is less than 3 "

My gradle is:

   implementation  'com.android.billingclient:billing:2.0.2'
   implementation 'com.betterme:rxbilling:2.0.0'
   implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.41'

Is that an expected error, can it be ignored?
I cannot test on a real device yet, because I do not have anything this recent.
But google will now be requiring API 29 compatibility, so I am trying to test on emulator.
I have searched for this error and just came across one discussion
https://stackoverflow.com/questions/56479824/google-play-in-app-billing-api-version-is-less-than-3

however it is not clear, it is relevant to me.
May be just google's own emulator image for Q was not updated with newer billing api?
thank you

A lot of derepcated warnings, is the latested beta release compatible with BillingClient 5.x ?

Hello,
I received App Store notification that I must migrate from Billing client 3x if I want to make any updates to the app.

Reminder: Starting on August 2, 2022, all new apps must use Billing Library version 4 or newer. By November 1, 2022, all updates to existing apps must use Billing Library version 4 or newer. Learn more.

When I just updated the billing client to 5x, things do not work.
Looking at the code, it seems that many constructs such as SkuDetails and others -- are deprecated.

It seems to be quite a bit of work to rewrite the code even on my application side.
But wanted to check -- is rxBilling compatible with the 5x android billing client, or nothing after 3x will be supported?

thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.