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

  • SEARCH
  • Home
  • 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 6903929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:59:11+00:00 2026-05-27T07:59:11+00:00

I am trying to launch an intent from a notification, but for a reason

  • 0

I am trying to launch an intent from a notification, but for a reason I don’t know the extra is not always sent with the intent.
This is where I create the intent :

NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon,
                    mContext.getString(R.string.text), 0);

Intent intents = new Intent(mContext, DataAppTabs.class);
intents.putExtra(DataAppTabs.REQUEST, DataAppTabs.REQUEST_DMTAB);
intents.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent launchIntent =    PendingIntent.getActivity(mContext.getApplicationContext(), DataAppTabs.REQUEST_DMTAB, intents, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(mContext, "Info", mContext.getString(R.string.enginedmnotification_rebootneeded), launchIntent);
notification.flags = Notification.FLAG_NO_CLEAR;
notification.flags |= Notification.FLAG_ONLY_ALERT_ONCE;
notification.defaults = Notification.DEFAULT_ALL;
notificationManager.notify(DataAppTabs.REQUEST_DMTAB, notification);

In the DataAppTabs class I overrided onCreate() and onNewIntent(). When the notification appears, if I click on it it opens the correct Activity (DataAppTabs, which is a TabActivity), it triggers onCreate or onNewIntent if the activity was already started, but the extra “REQUEST” is not always set (getExtras() is sometimes null).

I have found the same question here with answers telling me I had to use the “FLAG_ACTIVITY_SINGLE_TOP” flag, but it still doesn’t work all the time and I am not able to reproduce the problem every time.

Is it something I did wrong ?
Thanks

  • 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-27T07:59:12+00:00Added an answer on May 27, 2026 at 7:59 am
        // Displaying Notification
                  NotificationManager manager = (NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE);
                   Notification notification = new Notification(R.drawable.icon, "MyNotification", System.currentTimeMillis());
                    PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, new Intent(getApplicationContext(), Sample.class), 0);
                    notification.setLatestEventInfo(getApplicationContext(), "Notification Title", "Notification Data", contentIntent);
                    notification.flags = Notification.FLAG_INSISTENT;
    
                                int NOTIFICATION_ID=(int)System.currentTimeMillis();
                    manager.notify(NOTIFICATION_ID, notification);
    
    // Sample.class is the activity to which you want to go when you click on Notification
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am simply trying to launch an activity from a button but when I
I'm trying to launch an intent from my application that will play audio from
Trying to launch and pass tel. no. to skype by this code from my
I am trying to launch a MapActivity from Activity using intent. Following is how
I'm trying to launch another process from a service (it's a console app that
I am trying to launch an existing MS Access database (Access 2010) from a
I'm trying to launch another application from C# application, is there a way to
Here's the situation: I am trying to launch an application, but the location of
I'm trying to launch a service from another service with certain extras. However, I
I'm trying to figure out if it is possible to launch an intent within

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.