PeterStaev / nativescript-purchase

:moneybag: A NativeScript plugin for making in-app purchases!
Apache License 2.0
82 stars 28 forks source link

Android implementation problems #14

Closed davecoffin closed 7 years ago

davecoffin commented 7 years ago

Hey @PeterStaev, your documentation is still lacking Android implementation examples and I am a bit stumped. I have a In App Product configured in my google play console. I am attempting to initialize it like this in app.js:

if (app.android) {
  purchase.init(['dailynannyforparents_android']);
}

where dailynannyforparents_android is the id for the product in the google play console. Then, when the user taps a button I am calling:

purchase.getProducts().then(function(products) {
        console.dump(products);
});

But nothing is returned. When I step through the code, the promise initialized in the plugin is never resolved. Is it not reaching my google developer account? Is there more configuration I am missing?

PeterStaev commented 7 years ago

Hey @davecoffin , in what environment do you test this? If this is a sim, then you need to know that you cannot sandbox test in the android sim, unless you have hacked it and installed Google Play services on it. All API calls for the purcahases need Google Play. Take a look at http://stackoverflow.com/a/12283418/5272836

PeterStaev commented 7 years ago

No further response so closing this one for now. In case you still have problems, please reopen and provide more details.

davecoffin commented 7 years ago

Sorry I didnt comment back, I appreciate the help! I was trying on a genymotion emulator so that was probably my problem. Thanks!