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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:30:57+00:00 2026-05-27T17:30:57+00:00

I have an app that starts a service that continuously updates the notification bar.

  • 0

I have an app that starts a service that continuously updates the notification bar. The notification shows the state of the service. The service is written to sleep for a period and then do some work in the background then repeat. As such, my notifications are strings like:

Idle (3)

Idle (2)

Idle (1)

Working

Idle (3)

…

This all works well and good, the issue I’m seeing is that after a long period of time running, the CPU usage increase for an android process, specifically:

com.android.systemui

I am using “top” through the adb console. When I first start the app, it shows CPU% of 0~5% for com.android.systemui. After 30 minutes, the CPU% is ~80%.

In my class, I have the following code:
private NotificationManager _notificationManager;
private Notification _notification;
private CharSequence _lastNotification;

@Override
public void onCreate() {
    super.onCreate();
    _notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    _notification = createNotification();
}

@Override
public void onDestroy() {
    super.onDestroy();
    _notificationManager.cancel(getNotificationId());
}

private Notification createNotification() {
    final Notification notification = new Notification();
    notification.icon = R.drawable.notification_icon;
    notification.tickerText = getText(R.string.serviceStarted);
    notification.flags |= Notification.FLAG_ONGOING_EVENT;

    final RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.notification_layout);
    contentView.setImageViewResource(R.id.imageViewIcon, R.drawable.notification_icon);
    contentView.setTextViewText(R.id.textViewAppName, getText(R.string.appName));
    notification.contentView = contentView;
    return notification;
}

private void updateNotification(CharSequence message) {
    if (!message.equals(_lastNotification)) {
        _notification.contentView.setTextViewText(R.id.textViewState, message);
        _notificationManager.notify(getNotificationId(), _notification);
        _lastNotification = message;
    }
}

I’m at a loss as to why this could be happening. To combat this, I’ve put a workaround in that will clear the notification after the work is done and then put it back and that seems to have “fixed” the issue. The only problem, of course, is that the notification disappears and reappears every time the work is done.

  • 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-27T17:30:58+00:00Added an answer on May 27, 2026 at 5:30 pm

    take a look at
    Huge memory usage when updating the same notification to show progress
    and
    performance: csipsimple triggering periodic CPU spikes while registered

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

Sidebar

Related Questions

I have written a pretty simple Windows service in C# that starts up automatically
I have made an app that starts a service, which starts a timer, which
I have an app that starts out in the login screen and when you
I have a winforms app that checks user credentials as it starts. If autharization
I have an app that requires user to take a picture and then upload
We have a Service that continuously collects sensor data on the phone. This service
I'm making an app that starts a Service that sends SMS message periodically under
I have a WCF service in an ASP.NET AJAX app that is returning json.
I have an Activity that starts a Service. In my Activity: startService(new Intent(this, MyService.class));
In the app I am working on, I have an AlarmManager that starts a

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.