-1

I want to schedule an alarm according to the desired days. E.g. sunday,tuesday,thursday. I have scheduled it according to time but not able to do as week days.

Below is code:

private void StartScheduler(Context context) {

   Calendar startTimmer = Calendar.getInstance();
   startTimmer.setTimeZone(TimeZone.getDefault());        
   startTimmer.set(Calendar.HOUR_OF_DAY,sHour);
   startTimmer.set(Calendar.MINUTE,sMinute);
   startTimmer.set(Calendar.SECOND,00); 

   AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);         
   Intent StartAlarmTime = new Intent(Schedule_details.this, MyAlaramStartReceiver.class);         
   PendingIntent pendingIntent1 = PendingIntent.getBroadcast(context, 0, StartAlarmTime, 0);

   alarmManager.set(AlarmManager.RTC_WAKEUP, startTimmer.getTimeInMillis(),pendingIntent1);     
   Log.d("<<My-Start-Alarm>>", "ALARM Set To Start At: " + startTimmer.getTime().toLocaleString());

}

any help would be greatly appreciated........!

Mayank Nema
  • 223
  • 2
  • 7

1 Answers1

0

You can just write a wrapper around the class to convert the time you set into weekdays and then set your alarm accordingly

EDIT: check this out http://developer.android.com/reference/android/app/AlarmManager.html This has Half-Day Interval_hour etc which might help you

paradox
  • 377
  • 3
  • 12