[英]onNewIntent is called when app is launched from background
I have a singleTop
activity, this activity is launched via Intent
: 我有一个singleTop
活动,该活动是通过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. onNewIntent
被调用。
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
. 我的问题是,然后单击主页按钮,然后再次从后台启动应用程序(使用后台),以相同的意图再次调用onNewIntent
,而我找不到找到丢弃此Intent
。 I tried to putExtra
flag to this intent, but it is not persisted between application state changes. 我尝试将putExtra
标志用于此目的,但在应用程序状态更改之间不持久存在。
Is it possible to stop calling onNewIntent()
when application comes to foreground? 当应用程序进入前台时,是否可以停止调用onNewIntent()
?
在清单中,将以下行添加到MainActivity
android:finishOnTaskLaunch="true"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.