Birden fazla alarm
Birden fazla alarm kurmak istiyorum ama en son ayarladığım çalıyor sadece... Yardımcı olabilecek var mı?
TimePickerDialog.OnTimeSetListener onTimeSetListener = new TimePickerDialog.OnTimeSetListener(){ @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute)
{
Calendar calNow = Calendar.getInstance();
Calendar calSet = (Calendar) calNow.clone();
calSet.set(Calendar.HOUR_OF_DAY, hourOfDay);
calSet.set(Calendar.MINUTE, minute);
calSet.set(Calendar.SECOND, 0);
calSet.set(Calendar.MILLISECOND, 0);
calSet.set(Calendar.YEAR,yil);
calSet.set(Calendar.MONTH,ay-1);
calSet.set(Calendar.DAY_OF_MONTH,gun);
if(calSet.compareTo(calNow) <= 0){ calSet.add(Calendar.DATE, 1);
}
setAlarm(calSet); }
};
private void setAlarm(Calendar alarmCalender)
{
Toast.makeText(getApplicationContext(),"Alarm Ayarlandı!",Toast.LENGTH_SHORT).show(); Intent intent = new Intent(getBaseContext(), AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), REQUEST_CODE, intent,0);
AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, alarmCalender.getTimeInMillis(), pendingIntent);
}