我有A> B> C的任务堆栈我目前的C,然后我preSS home键。我收到了通知,意图要带我到活动答:我preSS的通知,和我在一个,但如果我preSS回来,我去到C,那么B,则A
I have a task stack of A > B > C. I am currently on C, and then I press the home button. I get a notification with the intent to take me to Activity A. I press the notification, and I'm at A but if I press back, I go to C, then B, then A.
我建立我的PendingIntent像这样。任何显然是错误的呢?
I am setting up my PendingIntent like so. Anything clearly wrong with it?
final Intent notificationIntent = new Intent(mContext, ActivityA.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent contentIntent = PendingIntent.getActivity(myContext, 0, notificationIntent, 0);
修改1:
我想建议在这里:清除任务中的所有活动
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
但我仍然得到同样的结果。我的活动A开始在我的应用任务堆栈,我preSS回转到C,然后是B,那么A了。
but I still get the same result. My activity A starts in my application task stack, I press back and go to C, then B, then A again.
我开始认为这不是没有可能的Android或它使用挂起的意图时,是不可能的。
I am starting to think that this is either not possible in Android or it's not possible when using a pending intent.
编辑2: 这不是需要什么样的标志的问题。更多的东西可以去错了一个问题,该旗似乎没有任何效果。
EDIT 2: This is not a matter of what flags are needed. More of an issue of what could be going wrong that the flags seem to have no effect.
如果乌拉圭回合使用的解决方案1,那么只需删除 launchMode =singleTask
从清单
if u r using solution 1 then Just remove the launchMode="singleTask"
from manifest
1)
final Intent notificationIntent = new Intent(mContext, ActivityA.class);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent contentIntent = PendingIntent.getActivity(myContext, 0, notificationIntent, 0);
或
2)
<activity
android:name=".ActivityA"
android:theme="@style/theme_noActionBar"
android:noHistory="true">
或
3)
<activity android:name=".ActivityA" android:launchMode="singleTop">
上一篇:如何从Android上的电子邮件选择器中删除的Facebook,Skype和不必要的选项不必要、选项、器中、电子邮件
下一篇:Java库消耗/操纵的Sharepoint 2013休息的OData XML结果消耗、结果、Sharepoint、Java