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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:24:37+00:00 2026-05-28T13:24:37+00:00

I have searched through Google, SO and Android developers but I need some further

  • 0

I have searched through Google, SO and Android developers but I need some further help for decision making. This has been discussed in discrete subjects but I’d like to have a bit of help with insight/design-decisions.

What I’d like to accomplish is a kind of timer that plays an alarm after, say 45 minutes, and plays an alarm, say 15 minutes after that. When the last alarm has fired, the cycle restarts indefinitely. This would sequentially look like Start -> 45min countdown -> Alarm -> 15min countdown -> Alarm -> go back to 45min countdown to repeat cycle.

This is an attempt at constructing a Work/Break-cycle app but I’m having both specific problems as well as probable design-flaws.

My goal, in short:

  • Create a Work/Break-cycle that fires alarms at specific intervals
  • Make it survive phone-sleep (without necessarily forcing to have the screen on)
  • Update the UI to get a feedback of progress for each interval/timer

Currently I’m (in general, there are a few specifics that differ) using a Service that implements a Runnable with a delay matching the duration of the different timers. When the first delay is up (after 45 minutes), another Runnable is initialized and run (set to 15 minutes).
This works pretty well. I make use of a partial wakelock for the Service and most of the times get this to run for about a cycle, but then things silently seem to stop. If I close the application and start it again, the cycle restarts.

Now, apart from this I’d like to update a UI with the amount of minutes left on each timer, which means I have to somehow, regularly, make “posts” to the UI in order to see a visual progress.

Am I going about this the right way? Should I have another approach on this and what would be a suitable one?

  • 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-28T13:24:38+00:00Added an answer on May 28, 2026 at 1:24 pm

    Use the AlarmManager to schedule alarms, passing in whatever Intent you’d like to occur at the the time you’ve scheduled the alarm for. When 45 minute alarm goes off, schedule another alarm and when that one goes off, schedule another 45 minute alarm, and so on.
    EDIT

    To update the UI each minute to tell how much time is left do something like this in your Activity:

    public class MyActivity extends Activity {
    int minutes = 45;
    TextView tv;
    public void onCreate(Bundle state) {
    super.onCreate(state);
    //set the content, grab your textview, etc...boilerplate
        Handler handler = new Handler();
        //schedule alarm here and post runnable as soon as scheduled
        handler.post(r)
    }
    
        //somewhere else in your Class
         Runnable r = new Runnable() {
                @Override
                public void run() {
                if(!minutes == 0)
                   tv.setText(minutes--);
                   handler.postDelayed(this, 60000); //run the runnable in a minute again 
                else 
                   handler.removeCallbacks(this);
                }
            };
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched through google and SO for possible answers to this question, but
I have searched through many times but have not seen this before. Probably really
I have searched but apparently my google foo is weak. What I need is
I have searched through the google and also joomla forums but didn't got what
I have searched the Web for this, but with no luck. Any idea? Thanks.
I've searched through stackoverflow and google's extension FAQ but could not seem to find
I have googled and searched after this topic, but could not find any good
I have searched through all the similar posts and google and have not quite
I have searched through net about C2DM and the process of registration of android
I've searched through Google and Stack Overflow for this and I've come up empty.

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.