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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:38:47+00:00 2026-06-11T19:38:47+00:00

My app will have several alarms set simultaneously. Unfortunately, each alarm is being set

  • 0

My app will have several alarms set simultaneously. Unfortunately, each alarm is being set with the same PendingIntent object. Here’s the code I’m using to set the alarm:

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

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

//Assign the reminder's primary key as the notification ID.
i.putExtra("Reminder_Name", editRemindMeTo.getText().toString());
i.putExtra("Reminder_Primary_Key", reminderPrimaryKey);

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

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

I know that I can delete an alarm by using the following code:

AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); 

Intent i = new Intent(context, MyPendingIntentService.class);
PendingIntent displayIntent = PendingIntent.getService(context, 0, i, 0);

alarmManager.cancel(displyIntent);

However, using this code will delete ALL my alarms (correct me if I’m wrong here). Is there a way to delete just the alarm that a user has deleted from the database? The alarm should be deleted from my app right after the user deletes an alarm entry in my app’s database. I’m guessing that using different PendingIntent names would be the way to go, but I have no idea how to do this for each new alarm that a user creates. Thoughts on how to do this? 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-11T19:38:48+00:00Added an answer on June 11, 2026 at 7:38 pm

    See the same problem i faced here previously…
    So the solution is to pass unique pending intent to the alarm service.. So here i how it can be done

    PendingIntent pIntent = PendingIntent.getBroadcast(context, (int) alarm_id, intent, PendingIntent.FLAG_CANCEL_CURRENT);

    here in the pending intent i have passed unique request id to the pending intent. Which you have to remember while cancelling the alarm.
    So in my case what i have done to generate the unique id is put it in the database i have retrieved the id of the tables row and passed to the pending Intent.
    So if you want to cancel the particular alarm you have to remember the same request id of the pending intent with the use of the same table entry…

    I am sure it will work..

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

Sidebar

Related Questions

I have a main app that will have many plugins. Here is the PluginReader
I'm creating an iPhone app that will have a preloaded set of locations with
I am working on a django project which will contain several apps. Each app
I'm doing an app that will have to connect to several hosts. Originally I
I have an alarm app with several different alarm types that may be triggered
I am programming an app that eventually will have several Activities. Right now, however,
I have an app that will have entries of both varchar(max) and varbinary(max) data
I am creating an app which will have a question in a UILabel and
I am developing a web app that will have two parts running on two
I'm developing a ASP.Net MVC3 app which will have few hundred videos. I want

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.