I built an app using Cordova 11, which I'm now trying to launch from a web link and potentially go to a specific screen in the app.
So far, with the aid of necessary config (config.xml, assetlinks.json in the correct directory on the web server), I've been able to have the app launch on a Samsung Galaxy Tab A when a link is clicked.
However, I still need some way to tell it to do something in the app (navigate somewhere else, display a message, etc).
In the Cordova world, I assume I need a plugin for this. There doesn't seem to be much out there, but I've found Darryn Campbell's fork(?) of the Intent plugin at https://www.npmjs.com/package/com-darryncampbell-cordova-plugin-intent
With the following code in mounted()
in a Vue.js page,
if (typeof window.plugins.intentShim !== 'undefined') {
console.log('*intentShim defined*')
this.hasIntentShim = true
console.log('getIntent call starting') // *A*
window.plugins.intentShim.getIntent(function (intent) {
_this.intentShimDetails = JSON.stringify(intent)
console.log('* intent details = ' + JSON.stringify(intent)) // *B*
},
function () {
console.log('error getting intent')
})
console.log('getIntent call completed') // *C*
}
And using USB debugging with Android Studio I can see output from lines A and C but not B.
Am I doing it right? When does getIntent
get called?
Is there a better Cordova plugin out there for working with Intents?