EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 365 forks source link

no intents received so far #298

Open adolfokrah opened 5 years ago

adolfokrah commented 5 years ago

hi, i have integrated the plugin in my app, when i click on the link link to app, the app opens fine but i get no intent received so far when window.plugins.launchmyapp.getLastIntent(function(url){},functon(error){});

aliendb commented 5 years ago

You can try confirm, if your app is opened in the background the window.plugins.launchmyapp.getLastIntent gets the no intent received so far. Close the app and try the link. and then it works fine based on what I observed. The handleOpenURL JavaScript function (shown below) works when the app is in the background or closed. Based on your requirements, if handleOpenURL won't work for you in all cases, you can try a little switching where you call both functions and use a boolean to check if one method executed and halt the second call.

function handleOpenURL(url) {
  console.log("received url: " + url);
}