Example usage for android.provider AlarmClock EXTRA_MINUTES

List of usage examples for android.provider AlarmClock EXTRA_MINUTES

Introduction

In this page you can find the example usage for android.provider AlarmClock EXTRA_MINUTES.

Prototype

String EXTRA_MINUTES

To view the source code for android.provider AlarmClock EXTRA_MINUTES.

Click Source Link

Document

Bundle extra: The minutes of the alarm.

Usage

From source file:Main.java

public static void setAlarm(Context context) {
    Intent alarmas = new Intent(AlarmClock.ACTION_SET_ALARM);
    alarmas.putExtra(AlarmClock.EXTRA_MESSAGE, "New Alarm");
    alarmas.putExtra(AlarmClock.EXTRA_HOUR, 10);
    alarmas.putExtra(AlarmClock.EXTRA_MINUTES, 30);
    context.startActivity(alarmas);//from w  w  w .  j a v a 2  s .  c o m
}

From source file:com.ephemeraldreams.gallyshuttle.ui.ScheduleActivity.java

/**
 * Build an alarm intent to pass to other activities or alarm applications.
 *
 * @param hour   Alarm hour to set.//ww  w  .  j  a v a 2s .c o m
 * @param minute Alarm minute to set
 * @return Alarm intent.
 */
private Intent buildAlarmIntent(int hour, int minute) {
    Intent alarmIntent = new Intent(AlarmClock.ACTION_SET_ALARM);
    CharSequence station = scheduleViewPager.getAdapter().getPageTitle(scheduleViewPager.getCurrentItem());
    alarmIntent.putExtra(AlarmClock.EXTRA_MESSAGE, station + " arrival reminder.");
    alarmIntent.putExtra(AlarmClock.EXTRA_SKIP_UI, false);
    alarmIntent.putExtra(AlarmClock.EXTRA_HOUR, hour);
    alarmIntent.putExtra(AlarmClock.EXTRA_MINUTES, minute);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        alarmIntent.putExtra(AlarmClock.EXTRA_VIBRATE, alarmVibrationBooleanPreference.get());
        if (TextUtils.isEmpty(alarmRingtoneChoiceStringPreference.get())) {
            alarmIntent.putExtra(AlarmClock.VALUE_RINGTONE_SILENT, true);
        } else {
            alarmIntent.putExtra(AlarmClock.EXTRA_RINGTONE, alarmRingtoneChoiceStringPreference.get());
        }
    }
    return alarmIntent;
}

From source file:com.ex.wakemeup.MainActivity.java

public void ringAlarmSound() {
    Toast.makeText(this, "You have reached your destination", Toast.LENGTH_SHORT).show();

    //Setting alarm
    Calendar cal = new GregorianCalendar();
    cal.setTimeInMillis(System.currentTimeMillis());
    int day = cal.get(Calendar.DAY_OF_WEEK);
    int hour = cal.get(Calendar.HOUR_OF_DAY);
    int minute = cal.get(Calendar.MINUTE);

    Intent i = new Intent(AlarmClock.ACTION_SET_ALARM);
    i.putExtra(AlarmClock.EXTRA_HOUR, hour);
    i.putExtra(AlarmClock.EXTRA_MINUTES, minute + 1);
    i.putExtra(AlarmClock.EXTRA_SKIP_UI, true);
    startActivity(i);/*from   w w w  .  ja  v  a  2  s  .  c o m*/
}

From source file:com.forrestguice.suntimeswidget.AlarmDialog.java

public static void scheduleAlarm(Activity context, String label, Calendar calendar) {
    if (calendar == null)
        return;//ww w.  ja v a  2s .co m

    Calendar alarm = new GregorianCalendar(TimeZone.getDefault());
    alarm.setTimeInMillis(calendar.getTimeInMillis());
    int hour = alarm.get(Calendar.HOUR_OF_DAY);
    int minutes = alarm.get(Calendar.MINUTE);

    Intent alarmIntent = new Intent(AlarmClock.ACTION_SET_ALARM);
    alarmIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    alarmIntent.putExtra(AlarmClock.EXTRA_MESSAGE, label);
    alarmIntent.putExtra(AlarmClock.EXTRA_HOUR, hour);
    alarmIntent.putExtra(AlarmClock.EXTRA_MINUTES, minutes);

    if (alarmIntent.resolveActivity(context.getPackageManager()) != null) {
        context.startActivity(alarmIntent);
    }
}

From source file:ai.api.sample.MainActivity.java

public synchronized void setAlarm() {
    cal = new GregorianCalendar();
    cal.setTimeInMillis(System.currentTimeMillis());
    day = cal.get(Calendar.DAY_OF_WEEK);
    hour = cal.get(Calendar.HOUR_OF_DAY);
    minute = cal.get(Calendar.MINUTE);

    Intent i = new Intent(AlarmClock.ACTION_SET_ALARM);
    i.putExtra(AlarmClock.EXTRA_HOUR, hour + 1);
    i.putExtra(AlarmClock.EXTRA_MINUTES, minute + 5);
    i.putExtra(AlarmClock.EXTRA_SKIP_UI, true);
    startActivity(i);/*from ww w .  j a  v a2  s  .  c om*/
}