Example #1
0
 /**
  * @param context
  * @param disablePoweroffAlarm
  */
 public static void setNextAlert(final Context context, boolean disablePoweroffAlarm) {
   final Alarm alarm = calculateNextAlert(context);
   if (alarm != null) {
     enableAlert(context, alarm, alarm.time, disablePoweroffAlarm);
   } else {
     disableAlert(context);
   }
   Intent i = new Intent(NEXT_ALARM_TIME_SET);
   context.sendBroadcast(i);
 }
Example #2
0
 /**
  * Called at system startup, on time/timezone change, and whenever the user changes alarm
  * settings. Activates snooze if set, otherwise loads all alarms, activates next alert.
  */
 public static void setNextAlert(final Context context) {
   // add by niezhong for NEWMS00134096 11-02-11 start
   //        if (!enableSnoozeAlert(context)) {
   //            Alarm alarm = calculateNextAlert(context);
   //            if (alarm != null) {
   //                enableAlert(context, alarm, alarm.time);
   //            } else {
   //                disableAlert(context);
   //            }
   //        }
   Alarm alarm = calculateNextAlert(context);
   long time = getSnoozeAlert(context);
   if ((alarm != null && alarm.time <= time) || (alarm != null && time == -1)) {
     enableAlert(context, alarm, alarm.time);
   } else if ((alarm != null && time < alarm.time) || (alarm == null && time != -1)) {
     enableSnoozeAlert(context);
   } else {
     disableAlert(context);
   }
   // add by niezhong for NEWMS00134096 11-02-11 end
 }