Open biesbjerg opened 8 years ago
Maybe related issue, apologies if not. When I add the plugin to my ionic 2 app, it breaks the automatic updating of DOM when value changes on Android (it still works fine on browser), effectively rendering it useless.
It sounds like the same issue. I've forked the repo and removed the polyfills if you want to give it a try. https://github.com/biesbjerg/cordova-plugin-inapppurchase
Interesting.
I had a similar issue with cordova-plugin-purchase (see https://github.com/j3k0/cordova-plugin-purchase/issues/174) that I managed to fix (turns out it's a bug in Angular 2).
I spent literally days trying to get one of those plugins working, it finally does, I won't switch again for now :) I'll definitely have a look should I want to clean things up a bit.
I am trying it......https://github.com/biesbjerg/cordova-plugin-inapppurchase
will let you know if it works...
@AlexDisler Would you accept a pull request that removes the Promise
polyfill for android?
It completely ruins change detection in Angular 2 when included because it overwrites Promise
after it has been patched by NgZone
(the magic stuff that wraps promises, to let Angular 2 know something changed).
I think the best solution is to document that this plugin needs support for Promise
to work on Android earlier than 4.4.4 (native Promise
support was added in this version), letting it be up to the developer if he want to include a polyfill.
Another option is to detect if promises are supported and don't overwrite if it is. Again, I think this should be the responsibility of the developer.
What do you think?
Yeah you're right, it's probably better to leave it up to the developer to provide a polyfill if they use an older version.
@biesbjerg
I had the same issue with an Angular 2 app. I used your version of the plugin and it works! great job!
JFYI this issue depends on under the es6-promise module's issue. https://github.com/stefanpenner/es6-promise/issues/224
and es6-promise v3.0.2 works fine.
Is this plugin maintained? I've been fighting with strange Android change detection for last month and couldn't find the source of the problem. Thanks @biesbjerg for pointing out what's the problem and preparing fixed version of the repo. Everything works correct now, and every promise trigger change detection in my games! I owe you.
Also running into issues with this. Would be nice to have this plugin maintained.
After switch to https://github.com/biesbjerg/cordova-plugin-inapppurchase I've started receiving email from users that they paid for the product, but didn't receive it in the app. I've tested it by buying item in own application, paid for it, and nothing happened. During debugging using adb logcat
:
Error retrieving purchase details
Strange. I have no problems like that at all
Here is the full output during restoring the previous purchase. I'm debugging it currently, as I have no idea what's going on here and I can't really fallback to this lib due to these promises.
11-24 20:04:34.193 16029 16340 I Finsky : [2434] com.google.android.finsky.billing.iab.s.a(5211): com.puppybox.quizlol: Account determined from installer data - [nao2U5dtnhib7xMSqTDde6NH-MY]
11-24 20:04:34.194 18699 19659 E IABUtil/Security: Purchase verification failed: missing data.
11-24 20:04:34.194 18699 19659 W IabHelper: In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
11-24 20:04:34.202 18699 18699 I HwSecImmHelper: mSecurityInputMethodService is null
11-24 20:04:34.203 18699 18699 I chromium: [INFO:CONSOLE(61)] "Error in Error callbackId: InAppBillingV3490543085 : TypeError: Cannot create property 'errorCode' on string 'Error retrieving purchase details'", source: file:///android_asset/www/build/main.js (61)
11-24 20:04:34.217 18699 18699 I chromium: [INFO:CONSOLE(314)] "Uncaught TypeError: Cannot create property 'errorCode' on string 'Error retrieving purchase details'", source: file:///android_asset/www/cordova.js (314)
I think I got it. My manifest.json file with Goole API key for purchases has been purged by Ionic build. I have changed the way how I put it into manifest, will upload new version of the game tomorrow, so will update here if it solves all the problems. Thanks for pointing out that it works for you, it helped me focus on the issues on my side.
Good to hear! You should put manifest in src/assets to have it copied automatically on build:-)
Shouldn't it be on the src/
directly? I'm just confused that without the key I'm able to pay for the product, but then Google can't verify what just I bought. Where's the logic Google?
As an example I'm looking at the https://github.com/driftyco/ionic-conference-app/tree/master/src
Sorry, you're right, I remembered incorrectly. src/
is the right place.
... And yeah, it seems weird you can use the IAB without a key, but I don't know enough about the native side of Google Play in-app purchases to know if it somehow makes sense on some level.
Has this android polyfill issue anything to do with my error ? #87
Ionic 2 (Uses Angular 2) includes their own polyfills for promises and are patching them to know when to update the view (if I understood correctly).
By using your plugin on android, the android polyfills will overwrite the promise implementation breaking the change detection mechanism. I suggest to remove the promise polyfill from the plugin and require either to use devices with webviews that support native promises or that a promise polyfill be manually included by the user, if he/she wishes to support older software. Do you think that is something we can do?