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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:17:19+00:00 2026-06-15T17:17:19+00:00

Question about alarm manager I have this code Calendar cal = Calendar.getInstance(); cal.add(Calendar.SECOND, 5);

  • 0

Question about alarm manager
I have this code

Calendar cal = Calendar.getInstance();
    cal.add(Calendar.SECOND, 5);
     Integer prof=t.getProfile();
    String prof2=prof.toString();
    Intent intent = new Intent(this, AlarmActivity.class);
    intent.putExtra("prof",(String)prof2);
    PendingIntent pendingIntent = PendingIntent.getActivity(this,(int)t.getId(), intent, PendingIntent.FLAG_CANCEL_CURRENT);
    AlarmManager am =
            (AlarmManager)getSystemService(Activity.ALARM_SERVICE);
    am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(),
            pendingIntent);

Its unfinished yet…
I know I can set time of the calendar with cal.set(Calendar.MINUTES,minutes); and same for hours..

But how do I set day? For example – monday?
day_of_week sets it? If so – range is 0-6 or 1-7? And lowest value is monday or sunday?

Also, if Im going to make repeating event (once a week) – should I make new calendar and set day of week/hours/minutes? or should I user getInstance() and change hour/min/day of week?

About alarm manager. When u make an alarm, you give request_code which
should be uniq. If I reboot my phone – does all the request codes stay
in alarm manager on phone? If no – how to make they stay… If yes –
how do I delete unnecesery made ones while testing?

  • 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-15T17:17:20+00:00Added an answer on June 15, 2026 at 5:17 pm

    You can also use:

    cal.add(Calendar.DATE, 7) 
    

    to set a calendars time to one week from the current calendars setting (and subtract and so forth).

    I think a link to the docs is probably warranted here:

    http://developer.android.com/reference/java/util/Calendar.html

    Regarding your second question, no alarm managers do not persist on phone reboot, you have to save them in shared prefs or SQL and then reload the alarms the next time the phone (and your app) restarts…

    To cancel an alarm you use alarm.cancel(pendingIntent). The pendingIntents you need to keep track of on your own.

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

Sidebar

Related Questions

( This question about refactoring F# code got me one down vote, but also
A question about this R code: library(RODBC) ch <- tryCatch(odbcConnect(RTEST), warning=function(w){print(FAIL! (warning));return(NA)}, error=function(e){print(paste(ERROR:,geterrmessage()));return(NA)}) df
I have a question about streamlining my jquery code. I have a list of
Question about GridView sorting in VB.NET: I have a GridView with AutoGenerateColumns = True
I'm new to android programming and i have a question I'm developing an alarm
Question about this helper http://codeigniter.com/user_guide/helpers/download_helper.html If, for example, program.exe weights 4 GB, will it
Question about html5 webaudio: is it possible to merge multiple songs together? I have
Question about threading to satisfy my curiosity... Let's say I have static variable _status
Question about OO design. Suppose I have a base object vehicle. And two descendants:
Question about how to perform a django query. I have a Game model with

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.