poiuytrez / AndroidInAppBilling

Android App Billing plugin for Cordova
173 stars 144 forks source link

Crash app after first payment #108

Open ragrep opened 8 years ago

ragrep commented 8 years ago

Hello, Use PhoneGap build, the plugin crashes the app just made your first payment. Does anyone have the same problem?

thank you

Pixcoder commented 8 years ago

Hi, same problem here ! Mysterious crash with "inappbilling.init(inappbillingsuccessHandler, inappbillingerrorHandler, {showLog:true}, product_SKU)".

Like ragTest said, it was after a first test payment. And now, a crash happens each time I start the app. The crash happens when "inappbilling.init()" is called.

The app is built with Phonegap Build. On the Google Play Dev Console, the APK is published in closed Alpha, not beta or prod.

I tried to create a new product on Google Play Dev Console. But no success. When building locally via "cordova run android --device", the app starts Ok. But it's impossible to buy the product.

Thank you

driannaude commented 8 years ago

@Pixcoder your issue is probably due to the fact that you are attempting a non-test purchase using an unsigned APK. For the most part you can consume purchases (inappbilling.consumePurchase(successCb, errorCb, SKU) and retry purchase if successfully consumed. The Android Store platform will not allow a second purchase if the first has not been "consumed". If you are using cordova to run a dev version, you should use the test products as defined by the Android Documentation. That link should show you the static responses you can expect from the different items. The test purchases work exactly the same as your own, so if a test purchase works, your own should too, provided it's valid.

You also do not need to pass the product_SKU on the init function. I'd recommend ensuring there are no race conditions between your init and your first purchase, could be that initialization is failing?

driannaude commented 8 years ago

@ragTest can you run the below command and paste the output that happens when you attempt a purchase?

adb logcat