Android - Clear task flag not working for PendingIntent

后端 未结 9 1970
夕颜
夕颜 2020-12-17 09:34

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 notificat

9条回答
  •  一个人的身影
    2020-12-17 09:58

    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);
    

    OR

    2)

           
    

    OR

    3)

    
    

提交回复
热议问题