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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:51:15+00:00 2026-05-30T00:51:15+00:00

I am developing alarm application for that I need to invoke alarm repeatedly for

  • 0

I am developing alarm application for that I need to invoke alarm repeatedly for the same time for all days. I am using the code to invoke the alarm,

c = Calendar.getInstance();

    c.set(Calendar.HOUR_OF_DAY,10);
    c.set(Calendar.MINUTE, 0);
    c.set(Calendar.SECOND, 0);
    c.set(Calendar.MILLISECOND, 0);

Intent intent = new Intent(HomeActivity.this, MyAlarmService.class);
            PendingIntent pendingIntent = PendingIntent.getService(HomeActivity.this, 123123, intent, 0);
            alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
            alarmManager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, c.getTimeInMillis(), (24*60*60*1000), pendingIntent);

By using this code I am only invoking present day at 10AM, not for all days. Is there another way to do this?

  • 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-30T00:51:17+00:00Added an answer on May 30, 2026 at 12:51 am
    1. Update time, and ring the alarm for every 5 minutes:

      Intent intent = new Intent(this, this.getClass());
      PendingIntent pendingIntent =
          PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
      
      long currentTimeMillis = System.currentTimeMillis();
      long nextUpdateTimeMillis = currentTimeMillis + 5 * DateUtils.MINUTE_IN_MILLIS;
      Time nextUpdateTime = new Time();
      nextUpdateTime.set(nextUpdateTimeMillis);
      
      AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
         alarmManager.set(AlarmManager.RTC, nextUpdateTimeMillis, pendingIntent); 
      
    2. Set when the alarm works for everyday (for example, 8am-18pm)

      // if not the time to ring, set to the next day
      if (nextUpdateTime.hour < 8 || nextUpdateTime.hour >= 18)
      {
          nextUpdateTime.hour = 8;
          nextUpdateTime.minute = 0;
          nextUpdateTime.second = 0;
          nextUpdateTimeMillis = nextUpdateTime.toMillis(false) + DateUtils.DAY_IN_MILLIS;
      }
      else{
          // call your alarm
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am developing a alarm application using BroadcastReceiver . Here i need to check
Hi i am new to android i am developing alarm application for that i
I am developing an application to pass a value to alarm through code. How
Developing with jQuery's TipTip (http://code.drewwilson.com/entry/tiptip-jquery-plugin). What I need is to show all of the
Developing websites are time-consuming. To improve productivity, I would code a prototype to show
Developing a C# .NET 2.0 WinForm Application. Need the application to close and restart
I am developing asp.net mobile application. I am using the XML as a database.
I am developing Alarm Clock. I want to compare a time now and setTime.
Developing for iPhone, I have a collection of points that I need to make
I'm developing an application of multiple socket connections (a TCP alarm watcher). Currently, in

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.