It's possible to call cordova plugin on app android from a external webapp embeded on app?

461 Views Asked by At

I have one simple cordova app, inside, I call one web application AngularJS. I need to call javascript/plugin inAppPurchase from web application.

Call external webapp from index.html cordova android.

<script>
  document.addEventListener("deviceready", onDeviceReady, false);
  function onDeviceReady() {
    if (navigator.network.connection.type == Connection.NONE) {
      networkError()
    } else {
      loadApp()
    }
  }

  function loadApp() {
    navigator.app.loadUrl("http://192.168.0.102:8000/")
  }
</script>

I have to call this plugin: InAppPurchase - https://github.com/AlexDisler/cordova-plugin-inapppurchase

It's plugin work fine on index.html on cordova app, but not work when call on webapplication:

Uncaught ReferenceError: inAppPurchase is not defined

Code inside external webapp to call plugin/javascript:

<script>
  inAppPurchase.getProducts(['vaga_de_veiculo'])
    .then(function (products) {
      console.log(products);
    })
  .catch(function (err) {
    console.log(err);
  });
</script>

I tried inAppBrowser, but, no success. Sorry, my bad english.

0

There are 0 best solutions below