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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:13:11+00:00 2026-06-05T09:13:11+00:00

Will this work? public void setRepeatingAlarm() { ArrayList<Integer> AlarmDays = datasource.getDays(); final int _id

  • 0

Will this work?

  public void setRepeatingAlarm() {

    ArrayList<Integer> AlarmDays = datasource.getDays();
    final int _id = (int) System.currentTimeMillis();

    Log.d("AlarmManageDebt", String.valueOf(AlarmDays));

    for (int i : AlarmDays) {

        Calendar cal = Calendar.getInstance();
        if (cal.get(Calendar.SECOND) >= 30)
            cal.add(Calendar.MINUTE, 1);
        cal.set(Calendar.SECOND, Integer.valueOf(i));

        Intent intent = new Intent(this, TimeAlarm.class);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(this, _id,
                intent, PendingIntent.FLAG_CANCEL_CURRENT);
        am.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
                60 * 1000, pendingIntent);
    }
}

I have a unique ID for the pendingIntent, and the only thing different in the alarm is the “i” variable that gives it new seconds depending on the database row (eventually, this will be a daily notification and “i” will represent a day, not a second. But this is for testing purposes. I have confirmed the correct data is being passed in “i”. I just am not sure if this will create three different alarms?

So am I creating multiple alarms here? or is each loop effectively replacing the one just created?

  • 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-05T09:13:13+00:00Added an answer on June 5, 2026 at 9:13 am

    Just based on what the docs say, I would imagine that you will only have one AlarmManager:

    “If there is already an alarm for this Intent scheduled (with the equality of two intents being defined by filterEquals(Intent)), then it will be removed and replaced by this one.”
    http://developer.android.com/reference/android/app/AlarmManager.html

    And here is how Intent equality is determined:
    http://developer.android.com/reference/android/content/Intent.html#filterEquals(android.content.Intent)

    Based on this I would say no, even though you have unique ids for the PendingIntent.

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

Sidebar

Related Questions

How can i make an extension method that will work like this public static
While this will work: new Thread(new Classimplementingrunnable(stuff, dostuff()).start(); This will not: new Thread(){ public
Will this work for testing whether a value at position index exists or not,
Anyone know why this will work: var wickedLocation = new google.maps.LatLng(44.767778, -93.2775); But this
ATM i cant quiet imagine how this will work. I'm sure it can be
What do I have to do so that this will work in the console
The way this function will work: 1) The user clicks the button with ID
I am unsure why this code will not work. When I click a button
I have this following snippet of code which will when I connect to work,
I have the this code that will create excel file and work sheet then

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.