I have strange problem. I want to launch my custom android app from my web app on browser. I have followed the article here http://androidsrc.net/launch-android-application-from-browser-using-uri/. And it worked, I successfully trigger my app when web app user will click on link. The problem is that I want to trigger it from js code behind.
here is the link:
<a id="launchLocationService" href="intent:#Intent;action=com.portacapena.theseusservicefrombrowser;category=android.intent.category.DEFAULT;category=android.intent.category.BROWSABLE;S.msg_from_browser=Launch;end">@Resources.GlobalResources.LaunchService</a>
I have tried jquery
$('#launchLocationService').click();
$('#launchLocationService')[0].click();
$('#launchLocationService').get(0).click();
and
$("#launchLocationService").on("click", function () {
alert();
});
alert triggered but app not.
when I replace window.location or window.location.href the behaviour is unexpected, it s triggering when user navigates another link.
var clickTarget = document.getElementById("launchLocationService");
var fakeMouseEvent = document.createEvent('MouseEvents');
fakeMouseEvent.initMouseEvent("click", true, true, window,
0, 0, 0, 20, 10, false, false, false, false, 0, null);
clickTarget.dispatchEvent(fakeMouseEvent);
This monster piece of code is also not working. Any ideas? Thanks in advance