Android: always got the old intention when opening links from the browser using the "Recent Applications" button

I want to achieve “launching the application from the Internet,” and I have two ready-to-use links on my web page. Opening any of the links really caused activity SchemeRedirectActivityand got the right intention. The problem is that I save (do not close) the links in the phone browser separately and:

open one link from a browser> press a key Recent Apps(for example, the right hardware key on the device)> open another link, it getIntent()always gives me the old intention, except for the first opening of each link.

manifest:

<activity
        android:name=".SchemeRedirectActivity"
        android:screenOrientation="sensorPortrait">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
</activity>

SchemeRedirectActivity:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    intent = getIntent(); //always got the old intent here
    Uri data = intent.getData();
}

, android:launchMode="singleTask"/"singleTop" , onNewIntent() :

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    Log.d("intent", "onNewIntent "); //never launched
    Uri data = intent.getData();

}

? * , , .

+1

All Articles