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 6532563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:01:12+00:00 2026-05-25T10:01:12+00:00

Unfortunately, I was unable to find a resolution to this issue in other StackOverflow

  • 0

Unfortunately, I was unable to find a resolution to this issue in other StackOverflow posts so I apologize in advance for re-posting this question. Essentially, I have an AppWidget that creates a Notification. I want the user to click the Notification to launch an Activity. The AppWidget and Activity are in the same APK.

The following code is all in the AppWidget. Clicking on the Notification broadcasts a custom Intent which is received by the AppWidget.

The problem is that the Activity does not appear to launch, even though logcat demonstrates that the custom Intent has indeed been broadcast. The only clue is the logcat message reiterated in the post title.

@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(Constants.BROWSER_INTENT)) {
        launchActivity(context, R.layout.appwidget, R.id.launch_button, Activity.class);
    }
    super.onReceive(context, intent);
}


private void displayNotification(Context context, String ticker, String title, String msg) {
    Intent intent = new Intent(context, ThisWidget.class);
    intent.setAction(Constants.BROWSER_INTENT); 
    PendingIntent pending = PendingIntent.getActivity(context, 0, intent, 0);

    NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(R.drawable.icon, ticker, System.currentTimeMillis());

    notification.setLatestEventInfo(context, title, msg, pending);
    notificationManager.notify(1, notification);
}

Some notes:

  • Pressing a button to execute launchActivity() works (it launches the
    Activity)
  • launchActivity uses Intent.FLAG_ACTIVITY_NEW_TASK as
    recommended by Android lifecycle documentation

Has anyone solved this issue when launching an Activity from a Notification press?

  • 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-25T10:01:13+00:00Added an answer on May 25, 2026 at 10:01 am

    er, figures, I answered my own question just minutes after posting it. I guess I was over-complicating the implementation by using an Intent action. I changed these lines:

       Intent intent = new Intent(context, ThisWidget.class);
       intent.setAction(Constants.BROWSER_INTENT); 
       PendingIntent pending = PendingIntent.getActivity(context, 0, intent, 0);
    

    to this:

       Intent intent = new Intent(context, Activity.class);
       PendingIntent pending = PendingIntent.getActivity(context, 0, intent, 0);
    

    and it worked.

    Sorry for the bogus post.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Unfortunately, my question is not as simple as keeping track of two windows created
Unfortunately it looks like for various reasons I'm going to have to use Visual
Unfortunately, I need to do this. I'm using ELMAH for my error log. Before
Unfortunately I don't have access to a *nix box at work or at home.
Unfortunately I have to use Windows Server 2003 on my 32 bit workstation due
Unfortunately the BOL is a little vague on this, but index_id = 0 on
I am aware of both this and this questions. Which unfortunately didn't quite answer
I have some queries that EF is unable to support: spatial, indexhints, etc. etc.
Unfortunately, there seems to be no string.Split(string separator), only string.Split(char speparator). I want to
Unfortunately, sometimes the only way to debug a program is by going through its

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.