Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android - get time of the next alarm

Tags:

android

Is there a way in Android to get the upcoming alarm time?

Thanks

Clarification: I am talking about the native android Alarm Clock appliction

like image 816
Daniel Benedykt Avatar asked Apr 08 '10 13:04

Daniel Benedykt


2 Answers

String nextAlarm = Settings.System.getString(getContentResolver(),
    Settings.System.NEXT_ALARM_FORMATTED);
like image 54
Steve Avatar answered Sep 21 '22 12:09

Steve


Starting with API level 21 the constant Settings.System.NEXT_ALARM_FORMATTED is deprecated.

Instead, you should use:

AlarmManager.getNextAlarmClock()

https://developer.android.com/reference/android/app/AlarmManager.html#getNextAlarmClock()

like image 26
OlegKrikun Avatar answered Sep 24 '22 12:09

OlegKrikun