MonkeyBonkey
MonkeyBonkey

Reputation: 47911

deep linking into a cordova app from a web browser on android opens app within the same browser window

On Android, if I open the mobile web browser and click on a deep link it opens the app, but doesn't open a new window and opens it within the same browser window.

How can I make it open an app rather than having the cordova web process run within the same window? I don't want to just put in target=_blank and have it spawn another web window, I'd like it to be an app window proper.

If you open the app manager the deep linked app that it opened in the same window will show up as a web page - however if you look at the debugger it will show up as an app proccess.

Upvotes: 1

Views: 661

Answers (1)

Stein Welberg
Stein Welberg

Reputation: 388

I faced exactly the same problem, but found the solution. It has nothing to do with Cordova actually.

If you want the intent that is fired to be handled by the instance of the app that is already open you need to change the launch mode of your Android app. If you specify singleTask as the launch mode this will tell Android to fire the intent on the instance of your app that is already launched. By default it will use the default launch mode which will launch a new instance.

In Cordova you can specify it by adding the following line to your config.xml

<preference name="AndroidLaunchMode" value="singleTask"/>

Upvotes: 1

Related Questions