I have an Android & IOS application developed using cordova. I have a scenario where I have to open my mobile application from a link sent as a Mail.
The plugin I am using is Cordova Universal Links Plugin and also I following the same method to include the link and open the application from the link.
The link for the plugin is here. When I try to open the app, its failing. How do I create a link which is sent as a mail to open the mobile application?
JS Code is
var app = {
// Application Constructor
initialize: function () {
this.bindEvents();
},
// Bind Event Listeners
bindEvents: function () {
document.addEventListener('deviceready', onDeviceReady.bind(this), false);
},
// deviceready Event Handler
onDeviceReady: function () {
console.log('Device is ready for work');
universalLinks.subscribe('openNewsListPage', app.onNewsListPageRequested);
universalLinks.subscribe('openNewsDetailedPage', app.onNewsDetailedPageRequested);
document.addEventListener('pause', onPause.bind(this), false);
document.addEventListener('resume', onResume.bind(this), false);
// TODO: Cordova has been loaded. Perform any initialization that requires Cordova here.
var parentElement = document.getElementById('deviceready');
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
},
// openNewsListPage Event Handler
onNewsListPageRequested: function (eventData) {
console.log('Showing list of awesome news.');
// do some work to show list of news
},
// openNewsDetailedPage Event Handler
onNewsDetailedPageRequested: function (eventData) {
console.log('Showing to user details page: ' + eventData.path);
// do some work to show detailed page
}
};
app.initialize();
Config.xml
<universal-links>
<host name="myhost.com">
<path url="/news/" event="openNewsListPage" />
<path url="/news/*" event="openNewsDetailedPage" />
</host>