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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:46:27+00:00 2026-06-15T05:46:27+00:00

I’ve had a problem with NotificationManager in my app for the past couple of

  • 0

I’ve had a problem with NotificationManager in my app for the past couple of days and I don’t seem to be getting closer to solving it.

I have a very simple service which does not do anything at the moment. It is just supposed to display notification:

public class UpdateService extends Service {
private static final String TAG = "UpdateService";
private static int NOTIFICATION_ID = 1;
private UpdateServiceBinder binder = new UpdateServiceBinder();

@Override
public void onCreate() {
        Log.i(TAG, "Service created");
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Log.i(TAG, "Service started");
    
    sendNotification(100);
    
    return Service.START_NOT_STICKY;
}

private void sendNotification(int updatedItems) {
    NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext())
            .setSmallIcon(R.drawable.icon)
            .setContentTitle("Sync")
            .setContentText("Updated " + updatedItems);
    
    Intent resultIntent = new Intent(getBaseContext(), MainActivity.class);
    
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(getApplicationContext());
    stackBuilder.addParentStack(MainActivity.class);
    stackBuilder.addNextIntent(resultIntent);

    PendingIntent resultPendindIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
    
    builder.setContentIntent(resultPendindIntent);
    
    NotificationManager manager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
    manager.notify(NOTIFICATION_ID, builder.build());
}
    
@Override
public IBinder onBind(Intent intent) {
    return binder;
}

@Override
public boolean onUnbind(Intent intent) {
    return true;
}

public class UpdateServiceBinder extends Binder {
    public UpdateService getService() {
        return UpdateService.this;
    }
}

}

Unfortunately, when the service is started and the notification is supposed to be displayed nothing happens. The service is definitely started according to log messages. At the same time there is warning from NotificationManager:

11-30 23:24:34.620: I/UpdateService(28356): Service created

11-30 23:24:34.800: I/UpdateService(28356): Service started

11-30 23:24:34.808: W/NotificationManager(28356): notify: id
corrupted: sent 1, got back 0

I tried using different numbers than 1 but it did not help. I am not sure what to make out of it. The code I’m using comes from the Android documentation on service in here and notifications in here. When I isolate the code in separate clean app which is setup in similar way to the one I’m working on notification is displayed correctly. Has anybody had this problem before or has any ideas?

Any help appreciated.
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-06-15T05:46:28+00:00Added an answer on June 15, 2026 at 5:46 am

    I found a solution to this problem. I had to change the package name from com.gttn.sample to com.gttn.sample2. Not really sure why I had to do it but the notifications show properly and the warning disappeared.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have been unable to fix a problem with Java Unicode and encoding. The
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

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.