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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:22:13+00:00 2026-06-06T00:22:13+00:00

I have an alarm that will not go off until specific hour and minute.

  • 0

I have an alarm that will not go off until specific hour and minute. However, once that time comes, it will go off everytime I start the app again. (When the app starts it resets and check for a new alarm).

For example, it will go off at 9:48 AM. Before 9:48 nothing happens as expected. But AFTER 9:48, it will keep going off everytime the app starts (The alarm is a simple status bar notification).

Here is code — where did I go wrong?

// Alarm set here – this code is called each time app starts up

public void setAlarm() {
 for (int i : AlarmDays) {

        Calendar cal = Calendar.getInstance();
        if (cal.get(Calendar.DAY_OF_MONTH) > i)
            cal.add(Calendar.MONTH, 1);
        cal.set(Calendar.DAY_OF_MONTH, i);
        cal.set(Calendar.HOUR, 9);
        cal.set(Calendar.MINUTE, 53);
        cal.set(Calendar.SECOND, 1);


        String Name = AlarmNames.get(count);
        count = 0 + 1;

        Intent intent = new Intent(ManageDebts.this, TimeAlarm.class);
        Bundle b = new Bundle();
        b.putString("keyvalue", Name);
        intent.putExtras(b);


        pendingIntent = PendingIntent.getBroadcast(this, i,
                intent, PendingIntent.FLAG_CANCEL_CURRENT);
        am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
                pendingIntent);

    }
 }

TimeAlarm.class

public class TimeAlarm extends BroadcastReceiver {

NotificationManager nm;

@Override
public void onReceive(Context context, Intent intent) {

    String DebtName = intent.getStringExtra("keyvalue");

    nm = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    CharSequence from = "Payment Due: " + DebtName;
    CharSequence message = "Update your Balance Now";
    Intent notificationIntent = new Intent(context, ManageDebts.class);
    notificationIntent.getExtras();
    PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
            notificationIntent, 0);
    Notification notif = new Notification(R.drawable.icon, "Pay "
            + DebtName + " today!", System.currentTimeMillis());
    notif.setLatestEventInfo(context, from, message, contentIntent);
    notif.defaults = Notification.DEFAULT_SOUND
            | Notification.DEFAULT_LIGHTS;
    notif.flags = Notification.FLAG_SHOW_LIGHTS;
    notif.ledOnMS = 100;
    notif.ledOffMS = 100;
    notif.flags |= Notification.FLAG_AUTO_CANCEL;
    nm.notify(1, notif);
}

}

  • 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-06T00:22:15+00:00Added an answer on June 6, 2026 at 12:22 am

    Where do I set it to ignore any Alarms that are NOT in that minute, hour and second? before OR after?

    In your setAlarm() method. Either filter things out from AlarmDays before you go in the loop, or compare cal.getTimeInMillis() to System.currentTimeMillis() to see if it is in the past, or something like that.

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

Sidebar

Related Questions

I need to set a repeating alarm that will once fired, launch a notification.
I'm building an app that will trigger notifications at specific time-intervals during the users
I have a code that sets a new repeating alarm (on production I'll use
I have an AlarmReceiver class which executes when alarm rings at a particular time
i have a problem with triggering the multiple alarm at first time , here
I'm not really writing an alarm clock application, but it will help to illustrate
I have an alarm app with several different alarm types that may be triggered
The question is very strange: i have done an app that set an Alarm
I need to create a timer that will send out an alarm (messagebox or
I have a property called Raised_Time, this property shows the time at which alarm

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.