Skip to content
This repository has been archived by the owner on Oct 19, 2020. It is now read-only.

App crash while call to inapppurchase.getProducts or any other method #220

Open
SanjayChaudhary02 opened this issue Mar 9, 2018 · 0 comments

Comments

@SanjayChaudhary02
Copy link

SanjayChaudhary02 commented Mar 9, 2018

After calling app crash , While i am trying first time in any device it's works . after even reinstall it's won't work.
I have installed only this plugins.
while i am build with CLI we getting warning :
(node:211372) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rej
ection id: 1): Error: ENOENT: no such file or directory, open 'myapp\platforms\android\assets\www\cordova_plugins.js'

I have added polyfill for promises too.(I have tried with or without this polyfill).
I am getting alert.
while i tried to debug i found app crash at this statement //962: cordova.js.
//111 : index-android.js
return new Promise(function (resolve, reject) {
window.cordova.exec(function (res) {
resolve(res);
}, createIapError(reject), 'InAppBillingV3', name, args);
});

//932: cordova.js
function androidExec
{
/////
//crash app at this statement
var msgs = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson);

bridgeSecret : "1101422782"
service : "InAppBillingV3"
action : "getSkuDetails",
callbackId : undefined
argsJson : "["quiz_12_micro_economics_8","quiz_12_micro_economics_9"]"

Your code / steps to reproduce

var app = {
    // Application Constructor
    initialize: function() {
        document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
    },

    // deviceready Event Handler
    //
    // Bind any cordova events here. Common events are:
    // 'pause', 'resume', etc.
    onDeviceReady: function() {
        this.receivedEvent('deviceready');
    },

    // Update DOM on a Received Event
    receivedEvent: function(id) {
        alert("device ready:"+id);
        // this.restore.bind(this);
        $("#load").click(function(){
            app.restore();
        });
    },
    restore: function(){
          if(inAppPurchase && inAppPurchase.restorePurchases){
          alert("b4 restore");
          inAppPurchase
            .getProducts(['quiz_12_micro_economics_8','quiz_12_micro_economics_9'])
            .then(function (products) {
              alert(products.length);
             })
            .catch(function (err) {
              alert(err);
            });
        }else{
          alert("no plugins founds");
        }
    }
};

app.initialize();

Console output

Type of product you are working with consumable/non-consumable/subscription

non-consumable products

Version of cordova

8.0.0

Version of iOS/Android

Android : 6.0.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant