0

I'm learning Android and want to write some kind of count-down timer application, so I get a ring-tone after certain minutes are elapsed. The timer also should work if the user has closed the application or switched to another one. If my application is running, it should be able to display the remaining time.

I've tried with CountDownTimer, but this seems only to work when the phone is activated, but not like the alarms which could ring you up at the morning. What other similar API alternatives are there to activate the device if the time is elapsed?

Thomas S.
  • 5,804
  • 5
  • 37
  • 72

2 Answers2

1

You can use AlarmManager for this purpose.

PgmFreek
  • 6,374
  • 3
  • 36
  • 47
1

count-down and alarm are two very different things (even thou both count time).

Count-down you probably want to run a service and put a notification with the flag ongoing = true updating the value of the time.

Alarm you want to use the AlarmManager (as pointed out by @PgmFreek) that you can schedule a specific time that the system will call an Intent for you.

Budius
  • 39,391
  • 16
  • 102
  • 144