Reputation: 57
I have an issue with deep links in Cordova when using a physical Android device. The app opens, but the event doesn't run.
To start, I have the "cordova-plugin-deeplinks" plugin installed with version 1.1.1 from Github "e-imaxina/cordova-plugin-deeplinks"
In my config.xml file, I have the following configuration:
<universal-links>
<host name="my.website.com" scheme="https">
<path url="/deep-link" event="loginExterno" />
</host>
</universal-links>
I've also set the following:
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="*" />
<access origin="*" />
<allow-navigation href="*" />
In the index.js file within the OnDeviceReady event, I have the following code:
universalLinks.subscribe('loginExterno', function (eventData) {
alert("deepLink - 1");
});
universalLinks.subscribe(null, function (eventData) {
alert("deepLink - 2");
});
I can see that in the AndroidManifest.xml file, the Intent is set correctly:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="my.website.com" android:scheme="https" android:path="/deep-link"/>
</intent-filter>
On the other hand, something I don't see in the res/config.xml file is the plugin. It should be automatically added as a feature, as I observe with other plugins.
In the Logcat, under the PluginManager section, I see this warning: "exec() call to an unknown plugin: UniversalLinks."
Running the following command from the command prompt opens the app, but the event isn't triggered:
adb shell am start -W -a android.intent.action.VIEW -d https://my.website.com/deep-link io.cordova.hellocordova
In summary, the deep link works when triggered from the console (I still can't trigger it from a web link), but the associated event doesn't run.
Cordova 12.0.0 ([email protected])
Plugins
cordova-plugin-deeplinks 1.1.1 "Cordova Deeplinks Plugin"
cordova-plugin-device 2.1.0 "Device"
cordova-plugin-dialogs 3.0.0-dev "Notification"
cordova-plugin-inappbrowser 5.0.0 "InAppBrowser"
cordova-plugin-nativestorage 2.3.2 "NativeStorage"
cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"
cordova-plugin-splashscreen 6.0.1 "Splashscreen"
cordova-plugin-statusbar 3.0.0 "StatusBar"
cordova-plugin-vibration 3.1.1 "Vibration"
cordova-plugin-x-socialsharing 6.0.4 "SocialSharing"
es6-promise-plugin 4.2.2 "Promise"
Samsung Galaxy A22 - Android 13 - minSdkVersion 21
Not using Ionic, just plain html, js, css
Upvotes: 1
Views: 248
Reputation: 57
Finally, it worked. All I did was uninstall e-imaxina/cordova-plugin-deeplinks
and install immament/cordova-universal-links-plugin
. When I did that, it threw errors, so I uninstalled it and reinstalled the previous
I had already tried with other plugins, but it didn't work for me. I had also tried uninstalling and reinstalling, but with no good results
Upvotes: 1