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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:46:53+00:00 2026-06-11T20:46:53+00:00

Okay, so I’ve looked at all the threads on StackOverflow, and I couldn’t find

  • 0

Okay, so I’ve looked at all the threads on StackOverflow, and I couldn’t find one that pertains to my situation, so I’m hoping you guys can help me out here. 🙂

I’ve got an app that needs to show multiple (2 or probably more) status notifications for different reminders that have been set at different times. Eg: Reminder 1 is set for 9:40AM so a notification pops up at 9:40AM. Reminder 2 is set at 10:10AM, so another different status notification pops up at 10:10AM below the notification that already popped up at 9:40AM.

My code works when there are no other notifications from my app when a reminder goes off. However, if there’s an existing notification (let’s call it Reminder 1) and the user hasn’t dismissed it, the new notification (let’s call it Reminder 2) never shows up, and Reminder 1 simply updates its timestamp to the time that Reminder 2 was supposed to go off. Basically, my code isn’t working for multiple, separate reminders that are supposed to go off at different times and coexist with one another.

Here’s the code from when I set the name of the reminder in the notification:

    /* Create a unique notifID that increments itself by 1 every time a new reminder is saved. */
int notifID = 0;
notifID = notifID + 1;

Toast toast = Toast.makeText(context, context.getString(R.string.reminder_saved),  Toast.LENGTH_LONG);
 toast.show();

c.set(mYear, mMonth, mDay); //Set the notification date.
c.set(Calendar.HOUR_OF_DAY, pHour); //Set the notification hour.
c.set(Calendar.MINUTE, pMinute); //Set the notification minute.
c.set(Calendar.SECOND, 0); //Set the notification second (always 0).

//Use AlarmManager to trigger the notification/alarm.
                AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);                 

                //Get the current date and time.
                Calendar calendar = Calendar.getInstance();       

                //Set the time for the notification to occur.
calendar.set(Calendar.YEAR, mYear);
calendar.set(Calendar.MONTH, mMonth);
calendar.set(Calendar.DAY_OF_MONTH, mDay);                 
calendar.set(Calendar.HOUR_OF_DAY, pHour);
calendar.set(Calendar.MINUTE, pMinute);
calendar.set(Calendar.SECOND, 0);

//PendingIntent to launch activity when the alarm triggers.                    
Intent i = new Intent();

/* Assign a notification ID to each notification. Because it is incremented by 1 for each new notification (see lines 1 and 2), there shouldn't be any duplicates. */
i.putExtra("NotifID", notifID);
    /* Get the name of reminder from the textbox and pass it into the intent. */
i.putExtra("Reminder_Name", editRemindMeTo.getText().toString());

                PendingIntent displayIntent = PendingIntent.getActivity(
                getBaseContext(), 0, i, 0);               

                //Set the alarm to trigger.
alarmManager.set(AlarmManager.RTC_WAKEUP, 
calendar.getTimeInMillis(), displayIntent);

Intent intent = new Intent(this, ViewLocalReminders.class);
startActivity(intent);

Here’s my actual notification code (It’s in a separate file that extends Activity):

public class DisplayReminderNotification extends SherlockActivity {

@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //Get the notification ID from the saved reminder (see previous code block).
    int notifID = getIntent().getExtras().getInt("NotifID");

    //PendingIntent stores the Activity that should be launched when the user taps the notification.
    Intent i = new Intent();
    i.putExtra("NotifID", notifID);

    PendingIntent detailsIntent = 
        PendingIntent.getActivity(this, 0, i, 0);

    //Get the name of the reminder from the previous activity (see previous code block)
    String reminderName = getIntent().getExtras().getString("Reminder_Name");

    NotificationManager nm = (NotificationManager)
        getSystemService(NOTIFICATION_SERVICE);
    Notification notif = new Notification(
        R.drawable.flag_red_large, 
        "App Name",
        System.currentTimeMillis());

    CharSequence from = "App Name";
    //Print the name of the reminder as the notification body.
    CharSequence message = reminderName;        
    notif.setLatestEventInfo(this, from, message, detailsIntent);

    //Pause for 100ms, vibrate for 250ms, pause for 100ms, and vibrate for 500ms.
    notif.defaults |= Notification.DEFAULT_SOUND;
    notif.vibrate = new long[] { 100, 250, 100, 500};        
    nm.notify(notifID, notif);

    //Destroy the activity/notification.
    finish();
}

}

Does anyone know what I’m doing wrong here? I’ve been trying to figure this one out for days and it’s been driving me nuts. I just need 2 or more reminders to coexist which each other when they’ve got different names and go off at different times. Again, everything works perfectly when there’s only one notification that comes up from my app. It doesn’t work only when I’ve got one notification thats sitting untouched in the notification drawer and another one tries to come in. I’m guessing there’s something wrong with my notifID, but I don’t what it could be. Thanks for all your help!

  • 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-11T20:46:54+00:00Added an answer on June 11, 2026 at 8:46 pm

    OKAY, so I finally figured this out! My solution might not apply to everyone’s specific app type, but it should hopefully give you guys a pointer in the right direction, if you’re having the same problem. I’m retrieving data from a database for each reminder, so I simply set the notification ID to the primary key in the database. Each reminder has its own unique primary key, so using that key gives me a unique notification ID as well! 😀

    Thanks a lot to everyone who helped point me in the right direction here. 🙂

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

Sidebar

Related Questions

OKay, this is probably pretty noob, but I couldn't find how to solve it.
Okay, I've looked all over the internet for a good solution to get PHP
Okay so I can't figure this out. Like a file that I using grep
Okay, i was wondering how to remove one line of code from all my
Okay, next PHPExcel question. I have an HTML form that users fill out and
okay, i'm setting up a multi-user chat system. i have a messages table, that
Okay, this one is pretty obvious to everyone who use Django and frequently asked
Okay, so I'm trying to make a game that uses this algorithm: http://www.codeproject.com/Articles/15573/2D-Polygon-Collision-Detection But
Okay, here is one weird bug... In my app, I load multiple xml files.
Okay the title cannot explain the situation correct enough. Now this is it, I

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.