---
title: "When notification item is clicked from status bar clear the back stack activity?"  
description: "When notification item is clicked from status bar clear the back stack activity?"  
author: "Anonymous User"  
published: 2014-10-14  
updated: 2014-10-14  
canonical: https://www.mindstick.com/forum/2374/when-notification-item-is-clicked-from-status-bar-clear-the-back-stack-activity  
category: "android"  
tags: ["android", "mobile development"]  
reading_time: 1 minute  

---

# When notification item is clicked from status bar clear the back stack activity?

I am working on a [chat](https://answers.mindstick.com/qa/100553/why-golgappa-and-aloo-chat-is-very-famous-in-india) project. When a [push notification](https://www.mindstick.com/forum/23082/windows-phone-7-push-notification-when-the-app-is-not-running) is being received from GCM, i need to navigate to the chat contact list and clear the previously opened [activity](https://www.mindstick.com/forum/12894/how-to-force-recreation-of-activity-fragment-on-restore) of my application.

## Replies

### Reply by Anonymous User

yes I have read and found the solution while passing the pending intent in GCMIntent Service, it is necessary to set flag for intent.I have mentioned the codes below. Please make use of it if anyone struggling with this concept

```
  PendingIntent contentIntent = PendingIntent.getActivity(this, 0,                    new Intent(this, MainActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |                             Intent.FLAG_ACTIVITY_CLEAR_TASK), 0);
```


---

Original Source: https://www.mindstick.com/forum/2374/when-notification-item-is-clicked-from-status-bar-clear-the-back-stack-activity

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
