Hi everyone!

I have an application with an activity named SplashActivity which has the 
following intent-filters defined.

<activity android:name=".SplashActivity" 
    android:configChanges="keyboardHidden|orientation" 
    android:launchMode="singleTop" 
    android:screenOrientation="portrait" 
    android:windowSoftInputMode="adjustPan">

    <intent-filter>
        <action android:name="android.intent.action.MAIN" /> 
        <category android:name="android.intent.category.LAUNCHER" /> 
    </intent-filter> 

    <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="abc"/> 
    </intent-filter> 
</activity>


Hence the activity can be launched from the launcher or from the browser by 
using the scheme abc:<parameters>.

*Scenario 1:*  I launch the app (SplashActivity) from the launcher and from 
SplashActivity I launch MainActivity.  Now the task has 2 activities with 
MainActivity on top.  I minimize with the HOME key and then relaunch the 
app from the launcher.  I will see the same 2 activity stack preserved. 
 This is the desired behavior so all is well.

*Scenario 2:*  I launch the app (SplashActivity) from the launcher and from 
SplashActivity I launch MainActivity.  Now the task has 2 activities with 
MainActivity on top.  I minimize with the HOME key and then launch a 
special webpage.  This webpage has a button that launches a url with the 
scheme "abc:<data>".  This launches SplashActivity.  However, this is 
launched in the browser task.  I would like for the original minimized task 
to be launched with SplashActivity as the root (FLAG_ACTIVITY_NEW_TASK 
might unify SplashActivity with the original instance that was in the 
background) and I would also like to add a flag of FLAG_ACTIVITY_CLEAR_TOP 
so that MainActivity is closed.  How do I achieve this?

The most promising option seemed to be to define SplashActivity as 
"singleTask" but for various reasons "singleTask" does not perform exactly 
as desired.  Most importantly, it seems to clear all the activities on top 
each time you relaunch SplashActivity.  This is fine for Scenario 2 but in 
Scenario 1 I do not wish to clear the activities on top.

So my question is, how can I achieve an outcome in Scenario 2 where on 
clicking the button on the webpage, my app is launched with SplashActivity 
at the root (not in the browser task) and MainActivity is closed.  The 
issue is that we can't control the intent from the browser.

Thanks!


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to