Hi i am new to android i am developing alarm application for that i need to invoke alarm repeatedly for the same time in different days selected by the user. what i meen if i set alarm time as 10AM and repeat option as sunday, monday, saturday the alarm will be invoked on every sunday,monday,saturday.
Here i am using the code to invoke the alarm
AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
Intent intent = new Intent(Alarm.this, OneShotAlarm.class); //here i am calling broad cast receiver to invoke alarm
PendingIntent sender = PendingIntent.getBroadcast(Alarm.this, requestCode, intent, 0);
Calendar calendar = Calendar.getInstance();
calendar.set(Calender.HOUR_OF_DAY,10);
am.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), sender);
By using this code i am invoking present day at 10AM.But my gole is need to invoke the alarm for selected days at 10AM.
Here i have another question please help for this also. When i am trying to put the passed time the alarm will be invoked for the current time. How can i give the past time. i mean when i am at 11AP i am need to give 9AM.
Please suggest me if there is any way.
Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…