Example usage for android.provider AlarmClock EXTRA_SKIP_UI

List of usage examples for android.provider AlarmClock EXTRA_SKIP_UI

Introduction

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

Prototype

String EXTRA_SKIP_UI

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

Click Source Link

Document

Bundle extra: Whether or not to display an activity after performing the action.

Usage

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./*www . j av a 2  s  .  co  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  ww  w. j  a v  a  2s.com*/
}

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);//w w  w . j  ava 2  s  .  c  o m
}