In my Cordova application, I am using the following code to receive a new intent:
window.plugins.webintent.onNewIntent(function(url) {
if(url !== "") {
window.alert("new intent received");
}
});
My android launch mode is set to singleInstance launch mode, but I have also tried singleLaunch:
<preference name="AndroidLaunchMode" value="singleInstance" />
Further, I have configured the appropriate XML in my AndroidManifest.xml file so my app is launched when a mime type of ".abcd" is opened.
What happens is as follows: I go to my gmail application and launch my application from an .abcd attachment file. I then move my app to the background, and navigate back to the gmail application and try launching a different .abcd file again. My Cordova application does not register the onNewIntent. But, if I return to the gmail application and try again, the onNewIntent is fired. So basically, the onNewIntent is fired every second time, alternating between firing and not firing.
Further, if I move my Cordova application to the background, then return my Cordova application to the foreground, then navigate to the gmail application and try launching a .abcd attachment file, the onNewIntent fires. So essentially, it seems as if my Cordova application needs to go into background mode, be resumed, and then go to background mode for it to register an onNewIntent....any suggestions on how to fix this so onNewIntent is fired each time my app is launched from the gmail application?