Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Crashed when buy product #374

Closed
anhdvz opened this issue Jan 23, 2019 · 10 comments
Closed

App Crashed when buy product #374

anhdvz opened this issue Jan 23, 2019 · 10 comments
Labels
🤖 android Related to android 🐛 bug Something isn't working 🚶🏻 stale Stale

Comments

@anhdvz
Copy link

anhdvz commented Jan 23, 2019

Version of react-native-iap

2.4.0-beta6

Version of react-native

0.57.5

Platforms you faced the error (IOS or Android or both?)

Android

Expected behavior

Buy success

Actual behavior

app crashed

Tested environment (Emulator? Real Device?)

Real device

Steps to reproduce the behavior

  1. Buy product from google
  2. Press home button to close app
  3. Launch app from icon on screen
  4. Buying modal disappear, buy product again
    Error log:
    Fatal Exception: com.facebook.react.bridge.ObjectAlreadyConsumedException
    Map already consumed
    com.facebook.react.bridge.WritableNativeArray.pushNativeMap (WritableNativeArray.java)
    com.facebook.react.bridge.WritableNativeArray.pushMap (WritableNativeArray.java:53)
    com.facebook.react.bridge.Arguments.fromJavaArgs (Arguments.java:187)
    com.facebook.react.bridge.CallbackImpl.invoke (CallbackImpl.java:32)
    com.facebook.react.bridge.PromiseImpl.resolve (PromiseImpl.java:30)
    com.dooboolab.RNIap.RNIapModule.resolvePromisesForKey (RNIapModule.java:526)
    com.dooboolab.RNIap.RNIapModule.access$800 (RNIapModule.java:46)
    com.dooboolab.RNIap.RNIapModule$11.onPurchasesUpdated (RNIapModule.java:443)
@hyochan hyochan added 🐛 bug Something isn't working 🤖 android Related to android labels Jan 24, 2019
@hyochan
Copy link
Member

hyochan commented Jan 24, 2019

I think this issue is also related to #315.

@hyochan
Copy link
Member

hyochan commented Jan 25, 2019

Please try beta8 then come back again.

@anhdvz
Copy link
Author

anhdvz commented Jan 31, 2019

i tried beta11 and this issue still happen

@hyochan
Copy link
Member

hyochan commented Jan 31, 2019

@anhdvz I've tested this yesterday with android.test.purchase but couldn't reproduce this. I think I need more details and helps out of the community to find out actual symptoms and solution.

@jimji1005
Copy link

Issue is Map already consumed, meaning you are purchasing the same item again. Google docs states you need to consume your purchase before buying it again.

@anhdvz
Copy link
Author

anhdvz commented Jan 31, 2019

@hyochan Did you close app (move to background) and launch app again from app's launch icon? When I did that, the processing of google iap is stop, and when i buy again, app crashed.
@jimji1005 How to do it? because I am in the middle of processing iap and I close it, so purchase did not happened and i can not consume it.

@anhdvz
Copy link
Author

anhdvz commented Jan 31, 2019

in my component:
async componentDidMount() {
try {
await RNIap.initConnection();
RNIap.consumeAllItems();
} catch (err) {}
}

async componentWillUnmount() {
await RNIap.endConnection();
}

@hyochan
Copy link
Member

hyochan commented Jan 31, 2019

@anhdvz The PR #379 by @dajaffe attempt to fix an issue as you've described lastly. However, you are saying no luck. I think we need this to be supported from react-native to provide a guide of handling background services especially in android.

@stale
Copy link

stale bot commented May 1, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the 🚶🏻 stale Stale label May 1, 2019
@stale
Copy link

stale bot commented May 31, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 android Related to android 🐛 bug Something isn't working 🚶🏻 stale Stale
Projects
None yet
Development

No branches or pull requests

3 participants