0

I have an activity for handling deeplink which is a browsable activity

suppose user clicks a link on another app and my browsable activity handles that intent

and start the app, then user minimise the app after use by pressing back button

if user reopen my app from running apps my browsable activity gets started instead of launcher activity

so my question is how can i start my app from launcher activity instead of browsable if user launches my app from running apps

Quora uses the same procedure, you can test by clicking a link of Quora on any other app

manifest of browsable activity

<activity android:name="com.example.android.deeplink"

         >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <data
                android:host="com.example"
                android:scheme="test" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
    </activity>

class code for handling intent data

Uri link = getIntent().getData();
ligi
  • 39,001
  • 44
  • 144
  • 244
Nishant Tanwar
  • 383
  • 4
  • 8
  • 18

1 Answers1

0

how can i start my app from launcher activity instead of browsable if user launches my app from running apps

There is more then one approach to achieve this goal,

I believe that the best and simplest way would be to add to your "browsable activity" an Activity flag:

android:excludeFromRecents="true"

settings this flag - will make sure that this activity will simply won't be shown in the recent tasks in the first place.

more info in the documentation - http://developer.android.com/guide/topics/manifest/activity-element.html#exclude

Tal Kanel
  • 10,475
  • 10
  • 60
  • 98
  • yeah , but this approach will exclude the whole app from running tasks which would be less user friendly can you tell me any other way to achieve this – Nishant Tanwar Sep 15 '14 at 14:09
  • no, it will exclude only tasks that started as entry point from the browsable activity – Tal Kanel Sep 15 '14 at 14:10
  • you are right, but can you tell any other way through which app still can be in running tasks but starts from launcher activity – Nishant Tanwar Sep 15 '14 at 14:16
  • actually I thought about that, and I can't think of another way to achieve this affect. when I'm thinking of that - I'll have to disagree with you: it won't make any sense for user to press on recent task with screenshot of the browsable activity, and see in fact your main screen activity (which looks different as far as I understood..) – Tal Kanel Sep 15 '14 at 14:25
  • yeah that's right but quora uses the same procedure you can check it out if you have quora installed . i don't know how they are doing this – Nishant Tanwar Sep 15 '14 at 14:29