How to use Cordova plugins in Capacitor app

How do i install cordova plugins in my ionic-capacitor app.I have seen this document . I want to install call number in my app ( .So i have run this command npm install --save @ionic-native/call-number.When i test the app on a device it is giving me error saying plugin not installed .When i run npx cap sync it is showing Found 0 Capacitor plugins for android: . How do i make cordova plugins work in my capacitor app.Somebody please help me

You are only installing the Ionic Native wrapper for the plugin, you also need to install the plugin itself:

npm install call-number --save

Now i have run the following commands

npm install --save call-number
npx cap sync

now it has detected the plugin and it is showing

Found 1 Cordova plugin for android:
CallNumber (1.0.1)

But i tried to import the plugin in my app.module file like this

import { CallNumber } from 'call-number';

It is showing me error like this [ts] Cannot find module 'call-number'.
Do i need to import it in app.module file or not?

You should be importing it from @ionic/native:

import { CallNumber } from '@ionic-native/call-number';

Thank you… Earlier i installed only call-number or @ionic-native/call-number never both. Now i have installed both the plugins and it working cool. Should i need to install the Ionic Native wrapper plugin and the plugin itself for other cordova plugins?

If you want to use the Ionic Native wrapper you need to install both, you can install just the plugin though. Generally, if the plugin is available in Ionic Native you should use it.

Alright thank you so much :grinning:

I tried to follow the same pattern to install speech recognition from by installing the native wrapper like this npm install --save @ionic-native/speech-recognition . When i run npx cap sync it just shows
Found 1 Cordova plugin for android:CallNumber (1.0.1)
I cannot see speech recognition here. So i need to install the plugin speech recognition also. But from where should i install the plugin?

I found the plugin…I issue is solved