React-native-iap: Shouldn't there be endConnection call somewhere for Android?

Created on 11 Apr 2018  路  6Comments  路  Source: dooboolab/react-native-iap

Hello!

According to https://developer.android.com/reference/com/android/billingclient/api/BillingClient.html

When you are done with this object, don't forget to call endConnection() to ensure proper cleanup. This object holds a binding to the in-app billing service and the manager to handle broadcast events, which will leak unless you dispose it correctly. If you created the object inside the onCreate(Bundle) method, then the recommended place to dispose is the the onDestroy() method.

But i can't find this in the code. Shouldn't it be somewhere actually?

As far as i know similar package for android has this: https://github.com/idehub/react-native-billing#close

Thanks.

馃崡 enhancement

Most helpful comment

@vshab I've just implemented endConnection method on android and tested. I think unlike what react-native-billing suggested, I think you can just call this method when a component is unmounted from your billing page instead calling it in every transaction. I've written how to use this in the README too. Please install 0.3.10 and try it.

All 6 comments

@vshab Nice catch! I will implement this tommorow! Will be updated in 0.3.10.

@vshab I've just implemented endConnection method on android and tested. I think unlike what react-native-billing suggested, I think you can just call this method when a component is unmounted from your billing page instead calling it in every transaction. I've written how to use this in the README too. Please install 0.3.10 and try it.

@dooboolab thanks for so fast fix.
Currently i'm working on iOS part of my app and will get to Android in a few days. I'll write here how it is as soon as I test it.

@dooboolab
Typo in readme. "componentWillUnmount" instead of "componentWillUnMount"

@vshab glad that you like it. Also @Symyon thank you for the report. I will change readme in next update.

FYI I've finished my android app part and this works well! I do call prepare and endConnection for every function call locking the the entire market screen while performing operation.
Thanks once again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ramondelmondo picture ramondelmondo  路  4Comments

MacMillan13 picture MacMillan13  路  3Comments

schumannd picture schumannd  路  3Comments

Symyon picture Symyon  路  5Comments

jvandenaardweg picture jvandenaardweg  路  4Comments