Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70818

Using Unity Ads Cordova Plugin in Capacitor

$
0
0

Hello everyone,

I would like to use com-artemisoftnian-plugins-unityads3 Cordova plugin inside my Capacitor app. As you know that plugin is not one of Ionic Native plugins.

I added plugin name to capacitor.config.ts.

  cordova:{
    staticPlugins:[
      'com-artemisoftnian-plugins-unityads3'
    ]
  }

Plugin has function exports like UnityAdsInit, ShowVideoAd etc. However, if I use functions by importing it directly I get error Cannot find module “cordova/exec”.

import { UnityAdsInit, ShowVideoAd } from 'com-artemisoftnian-plugins-unityads3/www/UnityAds3';
UnityAdsInit('1234567890', true, true, (res) => {
     console.log(res);
});

I found a way like to use plugin inse window object. But if I use plugin or exported function as window.UnityAdsInit() I get ‘window.UnityAdsInit’ is undefined error.

Actually I am not sure how I should use a Cordova Plugin in Capacitor app. How should I import or use Cordova plugin in Capacitor.

"@capacitor/core": {
      "version": "3.4.0",
}
"@ionic/core": {
      "version": "6.0.7",
}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70818

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>