Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6858901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:13:03+00:00 2026-05-27T02:13:03+00:00

I currently have a notification that displays in the notification bar and when the

  • 0

I currently have a notification that displays in the notification bar and when the user clicks it it should bring them to the root Activity of my application.

I have used android:finishOnTaskLaunch =”true” & android:clearTaskOnLaunch=”true” in my manifest to achieve this when the user presses the app icon from the apps screen or the home screen. The user is always taken to the root activity as expected.

However when I use the following code from my notification the user gets taken to the last screen they were on rather than the root activity which is StartActivity.

Does anyone know what I’m doing wrong?

   Intent notificationIntent = new Intent(this, StartActivity.class);
   contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
   notification.setLatestEventInfo(getApplicationContext(), getString(R.string.notification_app_name), notificationText, contentIntent);
   mNotificationManager.notify(1, notification);

Adding these flags helps however it still doesn’t work after a restart:

notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

When I restart my application I set a service running which pops up the notification and when I do this the notification reverts back to the old undesired behavior .

SOLVED:

Solved the issue by adding this flag to the contentIntent of my notification – Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED.

Here is an link with some excellent information on the area Google dev group

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:13:03+00:00Added an answer on May 27, 2026 at 2:13 am

    try this 2 properties

    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have an Activity that when it gets displayed a Notification will also
I currently have a notification in my Android application that has a PendingIntent so
I currently have a UINavigationController based application that works just fine. I'd like to
Currently we have many applications, where each application has its own error notification and
I currently have 4 textboxes which will be used to store an ip address.
I currently have a query that looks like this: SELECT NON EMPTY ([Measures].[TOTAL]) ON
I currently have links w/ class=ajax that I want to retrieve the element with
I currently have Google Maps integrated into my webpage. It is being used to
I currently have an app on the market that supports Android 1.5 (SDK level
I am currently developing a C# Windows Form Application that I intend to let

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.