Example usage for android.app AlarmManager getNextAlarmClock

List of usage examples for android.app AlarmManager getNextAlarmClock

Introduction

In this page you can find the example usage for android.app AlarmManager getNextAlarmClock.

Prototype

public AlarmClockInfo getNextAlarmClock() 

Source Link

Document

Gets information about the next alarm clock currently scheduled.

Usage

From source file:com.androidinspain.deskclock.Utils.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static AlarmClockInfo getNextAlarmClock(AlarmManager am) {
    return am.getNextAlarmClock();
}

From source file:com.android.deskclock.Utils.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static String getNextAlarmLOrLater(Context context) {
    final AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    final AlarmManager.AlarmClockInfo info = am.getNextAlarmClock();
    if (info != null) {
        final long triggerTime = info.getTriggerTime();
        final Calendar alarmTime = Calendar.getInstance();
        alarmTime.setTimeInMillis(triggerTime);
        return AlarmUtils.getFormattedTime(context, alarmTime);
    }/*  ww w  . j a  v  a 2  s . c  o  m*/

    return null;
}