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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:00:24+00:00 2026-06-05T11:00:24+00:00

In the below code, it is doing the main thing what I want so

  • 0

In the below code, it is doing the main thing what I want so far:
– Repeats every hour at the same time

Can someone verify if or what I need to do to make sure of the following items?

(1) The alarm will eventually be based on days of a month. As long as it goes off when they wake their phone up (to save battery). It is not hour or minute specific. Only day. How can this be achieved?

(2) If the Activity is destroyed or the phone is rebooted, I am not sure if my AlarmManager stays awake?

(3) Lastly, This code is repeated every time the app starts (thus overwriting any existing AlarmManagers; is this a proper way of doing things, or should I be checking to see if an Alarm exists?

 for (int i : AlarmDays) {

        if (String.valueOf(i) == null ) {
            continue;
        }

        Calendar cal = Calendar.getInstance();
        if (cal.get(Calendar.MINUTE) >= i)
            cal.add(Calendar.HOUR, 1);
        cal.set(Calendar.MINUTE, i);

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

//  TimeAlarm.class
public void onReceive(Context context, Intent intent) {


    String DebtName = null;

    nm = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    CharSequence from = "Payment Due";
    CharSequence message = "Open App and Update your Balance";
    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;
    nm.notify(1, notif);
}

And in my application tag in my manifest:

EDIT:

 <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
 <Application>        
  <receiver
        android:name=".TimeAlarm"
        android:enabled="true"
        android:exported="true" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>
 </Application>
  • 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-05T11:00:26+00:00Added an answer on June 5, 2026 at 11:00 am

    The AlarmManager will not persist across the phone being rebooted. However, it will persist across the application being killed by the Android scheduler. Because of this, you basically need to:

    • Store your schedule somewhere, and come up with a scheduling algorithm for deciding the next time you want an AlarmManager to fire.
    • Each time you get an alarm, schedule a new one.
    • Start the AlarmManager on boot, by catching the BOOT_COMPLETED broadcast.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C# 3.0, I'm doing the code below to declare a DateTime property and
Code below, not sure what i'm doing wrong. It is an employee database. The
My code below won't compile. What am i doing wrong? I'm basically trying to
Here is the code below i'm using, how do you trim while doing the
I'm doing a homework project that requires this: Below you will find the code
Below code only showing the textfield, but I want to include textfield and textarea.
Below code saying error incorreect syntax near Main INSERT INTO tbl ( 'Week', Main,
In below sample code, I use lambda function to make 3 threads doing different
Below code is for donwnloading file from azure blob. I have problem with .docx,.xlsx
Below code checks for last item but I need to check for the second

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.