I have some problems with proper task stack and bringing to front during deep-linking implementations... I have an Activity
declared like this:
<activity
android:name=".activity.ArticleSingleActivity"
android:label="@string/app_name"
android:launchMode="standard">
<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:scheme="http"
android:host="site.com"
android:pathPrefix="/article" />
</intent-filter>
</activity>
It has launchMode="standard"
and no parent, because this Activity
can be launched from many places in app: native buttons or from WebView
's. Even on bottom of almost every instance there are placed related articles, so it might call itself (new instance) and every article should appear in new "window"
And now: when my app is running in background and is visible in app manager deep-linking fires ArticleSingleActivity
on top of other activities without a problem. Intent contains these flags:
FLAG_ACTIVITY_BROUGHT_TO_FRONT
FLAG_ACTIVITY_NEW_TASK
FLAG_RECEIVER_FOREGROUND
When app isn't in back stack (lets say removed by user) ArticleSingleActivity
is launched without brought_to_front flag and everything starts like usual, but I've found small improper behaviour. When I navigate to another ArticleSingleActivity
(e.g. from related on bottom or to any other Activity
from side menu), then press home and try to open same deep-linked url then apps is just bring to front. It doesn't show linked article, but Activity
which was on top when app was "homed". Also breakpoints aren't firing in onCreate
, onActivityReenter
or even onNewIntent
. In my opinion system "remebers" that it have in back stack launched Acticity
matching this url so it just brings to front whole app, but not proper Activity
from the stack (no bring_to_front flag like above).
What can I do with this behaviour when I can't even set custom flags for this Intent
delivered by system or do any Intent
check in onCreate
because it isn't called at all in any alive Activity
on the stack?