3

I added this intent filter in my manifest file, and the deep linking is working.

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
     android:host="website.in"
     android:pathPrefix="/sometag/"
     android:scheme="https" />
</intent-filter>

The problem is that through deep linking, my app is launching on top of current app. If I am in Gmail and I click a link, then my app is launching on top of Gmail.

If my app is already running in background and I click on a link in Gmail which redirects to my app, I have two instances of my app running at the same time.One in the background, and another on top of Gmail. I want to run only one instance of my app at a time, so it's not also on top of the current app (Gmail).

Refered this link but not working solutions :Deep linking and multiple app instances

Zoe
  • 23,712
  • 16
  • 99
  • 132
Ashwini Bhat
  • 502
  • 1
  • 4
  • 17

2 Answers2

4

Finally got solution for my problem added

android:launchMode="singleTask"

in Android Manifest and override onNewIntent.and check whether existing instance is already created.

AskNilesh
  • 58,437
  • 15
  • 99
  • 129
Ashwini Bhat
  • 502
  • 1
  • 4
  • 17
1

You should use the launchMode attribute of your Activity (depending on what you expect to happen). Documentation is here

Simon Marquis
  • 6,577
  • 1
  • 23
  • 41