Closed roblav96 closed 7 years ago
Hey @roblav96 , nice to hear that you setup iOS that fast!
Sadly I'm not much of a build expert... The only thing that pops up in my mind is may be a problem that the helper AAR for android that the plugin uses is built with older SDK and built tools version: https://github.com/PeterStaev/nativescript-purchase/blob/master/android/inappbilling/inappbillinghelper/build.gradle#L4. Can you try to pull the repo, npm install
the deps and then adjust the values to what you are using in your project - I guess buildToolsVersion
should be 25.0.2
and not sure what SDK version are you using. Then simply run grunt build
which should build a new AAR in the bin/dist
folder and try to use that one, instead of the one coming from the NPM package of the plugin.
@PeterStaev Thanks for getting back to me.
I just figured out this dep debugCompile 'com.facebook.stetho:stetho-js-rhino:+'
was causing the problem. I have no idea why, but I got it to build.
I'm now having trouble getting purchase.getProducts
to return anything. I pulled this repo master
and built fresh using gulp build
then ran the demo.
Here's the example:
console.log('purchase.getProducts', purchase.getProducts) // gets logged
purchase.getProducts().then(function(products) {
console.log('products', products) // never gets logged
viewModel.set("items", products)
}).catch(function(error) {
console.error('Iap.init > error', error) // never gets logged
})
I'm gonna fork this repo and rewrite the android implementation using this library: https://github.com/serso/android-checkout if that's ok with you. Do you have any thoughts?
I was able to get the purchase to work.
You know you've got to initialize it in the app.ts/.js file right? And of course it has to be set up properly on the play store developer site.
Also it does take a while for the callback to come back the first time - about 10-15 seconds.
`
purchase.getProducts().then( (products: Array
this._buyProducts( products );
} ).catch ( (e) =>
{
alert({title: "ERROR1", message: e.message, okButtonText: "Close"});
})
`
Though I'm waiting for subscriptions to work :(
@roblav96 , I think you had to deploy the version to Google Play in order to get the list. I still have to write the android part of my guide, so I'm not 100% sure, as I forgot what was the case when i created the demo :) Also you need to deploy either to a device or to an emulator with installed Google Apps, as the whole billing on Android is dependent on the Google Play Store app.
As for using a 3rd party lib - i prefer not to use anything external as it makes support a lot harder - for example if anything needs to be fixed in the lib, or to be added
@PeterStaev You're totally right about the real device and gapps. I was knocking my head for so long trying to figure out why this wasnt working. lol Good point about the 3rd party libs.
@roblav96 , yes I know... Many small things that most users do not know out of the box. That's why I'm writing those tutorials, as you are not the only that came with the same problem ;)
Absolutely loving this plugin so far. I got it up and running on iOS in literally seconds =]
I'm having a problem building for android though.
I know it has to do with my gradle dependencies cause when I comment them all out it builds no problem.
Maybe you might be able to see something in these logs I'm not?
tns run android --log trace
app.gradle
dependenciesI hate asking for another set of eyes for this kind of stuff, but maybe it's something obvious to you?
Let me know what you think. Thanks mate!