Calling custom cordova plugic from ionic

I need to call a custom cordova plugin that I created in an ionic TS page. I tried all the tutorials but nothing works. For example, window.plugins is undefined. I can not find a working method to call my custom plugin. If there is an updated tutorial please send me a link. All tutorials I followed were outdated

What global variable does the plugin create? You defined that in plugin.xml and the actual plugin code.

Sorry but what do you mean with global plugin. You mean the plugin target ?

Sorry, I mistyped. “global variable” was meant. It is called “clobbers” or something like that.

yes clobbers target=“myPlugin” /

Then sounds like you need to use the myPlugin object, not window.plugins.

do I need to add anything in the app.module ? and do I need to import anything in the TS file?

First you just add the plugin to your Cordova app, run it on a device, remote debug it and type myPlugin into the console to see if the object actually exists. (Try with window and window.plugins or cordova or something of a Cordova plugin that definitely is working to check)

If it works, you put this after your imports so TS accepts the object.

declare var myPlugin: any;