In previous comment i show a way of catch the url in web app, here the deeplink in android app
Deeplinking:
I’ve installed the
cordova-universal-links-plugin-fix
cordova-universal-links-plugin
in cordova/config.xml
I’ve added these lines:
<universal-links>
<host name="my_website_url.com" scheme="https"></host>
</universal-links>
I’ve write it just over the line:
<platform name="android">
The universal-links can have some other parameters, like diferent events to be launched depending on diferent routes in the URL to be catch… as described in this link:
In js/cordova-app.js
I’ve added this:
var cordovaApp = {
f7: null,
//*** code added begins here ***
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
onDeviceReady: function() {
universalLinks.subscribe(null, cordovaApp.didLaunchAppFromLink);
},
didLaunchAppFromLink: function(eventData) {
alert('Did launch application from the link: ' + eventData.url);
//Here you have the URL to manage it as you wish...
},
// *** end of code added (added too a line later) ***
// This place you have more cordova-app.js code
init: function (f7) {
// This place you have more cordova-app.js code
// *** Next line added too...
cordovaApp.initialize();
},
};
export default cordovaApp;
And i’ve need to create a file in the server side:
In the route: /.well-known
I’ve need to create the file:
assetlinks.json
with this content:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "your.package.name",
"sha256_cert_fingerprints":
["THE:FINGER:PRINT:FROM:THE:SIGNED:APP"]
}
}]
To get the fingerprint from the signed APK i’ve used this command line code:
keytool -list -printcert -jarfile app-release-signed.apk
I’ve not uploaded yet the APK to Google Play, but if the APK is in Google Play you can find the fingerprint under: Setup → App Integrity
I’ve not used yet the webpage link described here:
So with this when I click on a url link the android device shows a dialog to chose open the link in the app or in the navigator
I’ve seen there is other diferent thing named intent filters, but i’ve not yet understand and use it… The intents are described here:
And i’ve find a intents plugin too: