문제

I do not know if you get my question right, so let me explain:

My app is shown in the chooser after user clicks a web link in any other app, then user clicks on my app and my app shows the link in a webview. This works fine.

But, the problem is when the user launches the other app again (which invoked my app earlier) with a click on the icon that is on the home screen or app drawer, it opens my app again instead of the origin app.

Manifest:

<activity
    android:name="com.droidfox.app.browser"
    android:label="@string/browser"
    android:theme="@android:style/Theme.Black.NoTitleBar"
    android:launchMode="singleTop"
    android:configChanges="orientation|keyboardHidden|keyboard|screenSize" >
    <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="http" />
        <data android:scheme="https" />
    </intent-filter>
</activity>

Back Button Override:

@Override
public void onBackPressed () 
{
    moveTaskToBack(true);
}

Does anyone have a clue why the other app launches my app and how can I fix this?

도움이 되었습니까?

해결책

Try to set android:noHistory for your given activity.
Taken from documentation:

Whether or not the activity should be removed from the activity stack and finished (its finish() method called) when the user navigates away from it and it's no longer visible on screen — "true" if it should be finished, and "false" if not. The default value is "false". A value of "true" means that the activity will not leave a historical trace. It will not remain in the activity stack for the task, so the user will not be able to return to it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top