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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:09:05+00:00 2026-06-10T07:09:05+00:00

I am trying to use a while loop in order to update a notification

  • 0

I am trying to use a while loop in order to update a notification every second. However on 2.3.3 & below, it crashes with these logcat errors:

08-14 07:30:17.394: E/AndroidRuntime(501): FATAL EXCEPTION: main
08-14 07:30:17.394: E/AndroidRuntime(501): 
android.app.RemoteServiceException: Bad notification for startForeground: 
java.lang.IllegalArgumentException: contentIntent required: 
pkg=com.package.name id=77 
notification=Notification(vibrate=null,sound=null,defaults=0x4,flags=0x40)

The problem is even when I check Build.VERSION, the code crashes with the same logcat errors:

if (isRunning) {
        n.defaults = Notification.DEFAULT_LIGHTS;
        while (!RecordTimerTask.isRunning && isRunning) {
            long now = System.currentTimeMillis() - startTime;
            n.setLatestEventInfo(getApplicationContext(), getResources()
                    .getString(R.string.notify_title),
                    getDurationBreakdown(now), null);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
                startForeground(FOREGROUND_ID, n);
            else 
                notify.notify(ID, n);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

It seems like devices running 2.3.3 & below don’t like the null notification intents.
What I don’t understand is why I get a logcat error about startForeground when it’s never called?

  • 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-06-10T07:09:06+00:00Added an answer on June 10, 2026 at 7:09 am

    The problem is you call setLatestEventInfo with a null argument for the pendingIntent. This works on Android ICS but not on earlier versions…

    Have a look on the documentation for the setLatestEventInfo.

    Here is how your code should look (if you are pushing these notifications from a service):

            // The PendingIntent to launch our activity if the user selects this notification
        PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                new Intent(this, LocalServiceActivities.Controller.class), 0);
    
        // Set the info for the views that show in the notification panel.
        notification.setLatestEventInfo(this, getText(R.string.local_service_label),
                       text, contentIntent);
    

    Code was quoted from Android official documentation.

    Also see this for a similar issue on StackOverflow.

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

Sidebar

Related Questions

I use an old Powerbook G4. While trying to update the macports (sudo port
I am trying to use a while loop to loop through some data and
I am trying to use a do...while loop that loops based on the id's
Hello i'm trying to use a do-while loop to check the input and repeat
While trying to use LINQ in a .NET 2.0 Windows Forms project I got:
While trying to use XMLWorkerHelper.GetInstance().ParseXHTML() i find that it is really strict. Any wrong
I was trying to use the function glMultiDrawElements while studying OpenGL (using red book)
I'm getting an error while trying to use the action_mailer_tls plugin to communicate with
I am getting some problems while trying to use this regex: (public +function|private +function|function)
Getting system.entrypointnotfoundexception: loadlibrary While trying to use SevenZipLib.dll to uncompress the .7z file containing

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.