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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:13:34+00:00 2026-05-29T21:13:34+00:00

I am adding some notification in my app and storing the data given in

  • 0

I am adding some notification in my app and storing the data given in a database. Now I want to update the data stored in the database and I want to remove notification for previous data create notification for updated data. I’m using an arraylist of alarm manager with request codes incrementing. Can Anyone help me to delete the old notification and create new notification. If you need to see the code I will post it.

for(int i=0;i

                        if(j==0){
                                  longobjDate=objDate.getTime();
                            longobjTime=objTime1.getTime();
                            long longDay=longobjDate+longobjTime+19800000;
                            Intent intent=new Intent(New_Med.this,Alarm_Reciever.class);
                            PendingIntent pendingIntent=PendingIntent.getBroadcast(New_Med.this, k, intent, 0);
                            AlarmManager alarmManager=(AlarmManager) getSystemService(ALARM_SERVICE);

                            alarmManagers.add(alarmManager);
                            alarmManagers.get(k).set(AlarmManager.RTC_WAKEUP, longDay, pendingIntent);

                            Toast.makeText(New_Med.this, "Alarm set", Toast.LENGTH_SHORT).show();
                            k=k+1;
                            db1.insertNotificationDetails(med_id, longobjDate, longobjTime);
                        }
                        if(j==1){
                            longobjDate=objDate.getTime();
                            longobjTime=objTime2.getTime();
                            long longDay=longobjDate+longobjTime+19800000;
                            Intent intent=new Intent(New_Med.this,Alarm_Reciever.class);
                            PendingIntent pendingIntent=PendingIntent.getBroadcast(New_Med.this, k, intent, 0);
                            AlarmManager alarmManager=(AlarmManager) getSystemService(ALARM_SERVICE);

                            alarmManagers.add(alarmManager);
                            alarmManagers.get(k).set(AlarmManager.RTC_WAKEUP, longDay, pendingIntent);



                            Toast.makeText(New_Med.this, "Alarm set", Toast.LENGTH_SHORT).show();
                            k=k+1;
                            db1.insertNotificationDetails(med_id, longobjDate, longobjTime);

                        }
                        if(j==2){
                            longobjDate=objDate.getTime();
                            longobjTime=objTime3.getTime();
                            long longDay=longobjDate+longobjTime+19800000;
                            Intent intent=new Intent(New_Med.this,Alarm_Reciever.class);
                            PendingIntent pendingIntent=PendingIntent.getBroadcast(New_Med.this, k, intent, 0);
                            AlarmManager alarmManager=(AlarmManager) getSystemService(ALARM_SERVICE);

                            alarmManagers.add(alarmManager);
                            alarmManagers.get(k).set(AlarmManager.RTC_WAKEUP, longDay, pendingIntent);


                            Toast.makeText(New_Med.this, "Alarm set", Toast.LENGTH_SHORT).show();
                            k=k+1;
                            db1.insertNotificationDetails(med_id, longobjDate, longobjTime);

                        }
                        if(j==3){
                            longobjDate=objDate.getTime();
                            longobjTime=objTime4.getTime();
                            long longDay=longobjDate+longobjTime+19800000;
                            Intent intent=new Intent(New_Med.this,Alarm_Reciever.class);
                            PendingIntent pendingIntent=PendingIntent.getBroadcast(New_Med.this, k, intent, 0);
                            AlarmManager alarmManager=(AlarmManager) getSystemService(ALARM_SERVICE);

                            alarmManagers.add(alarmManager);
                            alarmManagers.get(k).set(AlarmManager.RTC_WAKEUP, longDay, pendingIntent);


                            Toast.makeText(New_Med.this, "Alarm set", Toast.LENGTH_SHORT).show();
                            k=k+1;
                            db1.insertNotificationDetails(med_id, longobjDate, longobjTime);

                        }

                    }
                    long t=objDate.getTime();
                    t=t+(24*60*60*1000);
                    objDate= new Date(t);
                }

I am saving alarm managers like this. I’m totally new to android. So please help me by a coded example way…

  • 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-29T21:13:35+00:00Added an answer on May 29, 2026 at 9:13 pm

    Find the request code of the particular notification and use AlarmManager class object to cancel
    the pending intent.
    For Example:

        AlarmManager alarmManager4 = (AlarmManager)getSystemService(ALARM_SERVICE);
        Intent I = new Intent(getApplicationContext(),AlarmReceiver.class);
        PendingIntent P = PendingIntent.getBroadcast(getApplicationContext(), <request_code>, I, 0);
        alarmManager4.cancel(P);
        P.cancel();
    

    If you cancel using alarm manager, then its notification can also be cancelled since it gets initiated from alarm manager.

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

Sidebar

Related Questions

Looking at adding some data graphing to a new iPhone app in development (ala
I'm looking into adding some unit tests for some classes in my data access
Adding some gui modifications and I want to have a button which is 10pixels
I'm adding some custom data data to the registry during the registration of a
I'm adding some logic to my web app to lookup geo-coordinates for a user,
I'm using Sencha's Ext.data.Store to hold some items. Right now they come from an
I am adding some images to a div from a database in the Page_Load()
I am adding some data to a list and it might take a while
When I'm adding some constraints, e.g: create table Test( IDTest int primary key, Credit
I've been adding some components to a Flex 4 app (it was originally Flex

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.