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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:46:08+00:00 2026-05-23T10:46:08+00:00

I am a bit lost with PendingIntent. As far as I could understand, it’s

  • 0

I am a bit lost with PendingIntent.

As far as I could understand, it’s a Token given to the OS to perform later (hence pending) operations.

I have an activity that launched a service. The service, occasionally creates a notification.
What I am trying to do, as the simplest of all, is to bring the activity to the front.

I am not sure where and how I create and to whom I send the PendingActivity.

  • If I create it within the Activity, I need to send it to the service – HOW?
  • If I create it within the service, how would the context be to call the activity? are these the same? – I though these are the same, as how the OS works, but it did not work for me.

Here are some code lines

This is not working btw StartService gets an Intent.
This code is in my activity

        Intent intent = new Intent(this, NeglectedService.class);

    // The PendingIntent to launch our activity if the user selects this notification
    PendingIntent contentIntent = PendingIntent.getActivity(this, 
            0,
            intent, 
            PendingIntent.FLAG_ONE_SHOT);

    startService(contentIntent);

So, the correct one is

Intent intent = new Intent(this, NeglectedService.class);
startService(contentIntent);

So I think to make the pending intent in my service, but this didn’t work for me, as I am not sure how to reuse/use the intent

Notification notification = new Notification(R.drawable.icon, 
            extra, 
            System.currentTimeMillis());

    PendingIntent contentIntent = PendingIntent.getActivity(this, 
            0,
            intent, // not sure what intent to use here !!!!
            PendingIntent.FLAG_ONE_SHOT);

    notification.setLatestEventInfo(getApplicationContext(), contentTitle, contentText, contentIntent);
    notification.defaults |= Notification.DEFAULT_SOUND;
    notification.defaults |= Notification.DEFAULT_LIGHTS;
    notification.defaults |= Notification.FLAG_INSISTENT;

    mNotificationManager.notify(id, notification);
  • 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-23T10:46:08+00:00Added an answer on May 23, 2026 at 10:46 am

    solved
    What needed to be done, is use the Neglected.class in the intent.

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

Sidebar

Related Questions

Ok so.. I'm a bit lost. What i have is a window1.xaml just a
I am a bit lost here, solution could be lurking under my nose but
So I'm getting a bit lost with CActiveRecord in Yii. Let's say I have
I'm a bit lost here. I have a class subclassed from UIView called BalloonGuy.
I'm a bit lost here... I have several tables I'd like to pull a
I am a bit lost. Maybe it's that I don't understand jQuery that well
I am a bit lost here as I have not really looked at model
I'm a bit lost in a migration to Play 1.2. We have a set
I'm a little bit lost. I have created a small app that is starting
I am a bit lost as to how to explain this, so I will

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.