0

I have a singleTop activity, this activity is launched via Intent:

    Intent intent = new Intent(GCMIntentService.this,MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

onNewIntent is called.

My problem is that then I hit home button, and then launch application again (from background) onNewIntent is called again with the same intent, and I can not find a way to discard this Intent. I tried to putExtra flag to this intent, but it is not persisted between application state changes.

Is it possible to stop calling onNewIntent() when application comes to foreground?

4

1 回答 1

0

在您的清单中,将下面的行添加到您的 MainActivity

android:finishOnTaskLaunch="true"
于 2013-03-22T15:49:27.657 回答