Unable to implement deep link in ionic capacitor application

I am working on a project and it’s related to ionic capacitor application, I am trying to implement deeplink in my project(open my app when the link is clicked on a website), I have installed the plugin

npm install @ionic-native/deeplinks
and I am trying to run a command i.e
ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=demo --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=[demo.com](http://demo.com) --variable ANDROID_PATH_PREFIX=/

But I am facing the error :
[ERROR] Refusing to run ionic cordova plugin inside a Capacitor project.

I’ve also tried the command
npm i ionic-plugin-deeplinks -variable URL_SCHEME=demo -variable DEEPLINK_SCHEME=https -variable DEEPLINK_HOST=[demo.com](http://demo.com) -variable ANDROID_PATH_PREFIX=/

but facing the error :

npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "URL_SCHEME=demo" of package "URL_SCHEME=demo": Tags may not have any characters that encodeURIComponent encodes

Can anyone help me out with this please, I would greatly appreciate it.

Hi @bhavyaj, for a Capacitor project, you can implement deep links for iOS and Android as described at Deep Links | Capacitor Documentation. I went through this recently on a Capacitor 5.x app and it worked well.

what about deeplinking without website?

The above deep link feature will link to the app directly if it’s installed (without routing through the website), and only use the website as a fallback. Good question how it works if you don’t offer the web fallback, might be platform dependent. More details at Deep Links | Capacitor Documentation.

Well I see there the need for .well-known being actually hosted somewhere and some more config related to the actual hosed domain. I just found pure and direct scheme based deeplinking example (tried - it’s surprisingly simple and it works) at the bottom of this instruction

1 Like