this is how I set my alarm clock:
//all this inside a onClickListener
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, 30);
cal.set(Calendar.MONTH, 8);
cal.set(Calendar.YEAR, 2020);
Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM);
intent.putExtra(AlarmClock.EXTRA_HOUR, Integer.parseInt(str1));
intent.putExtra(AlarmClock.EXTRA_MINUTES, Integer.parseInt(str2));
intent.putExtra(AlarmClock.EXTRA_MESSAGE, title.getText().toString());
intent.putExtra(AlarmClock.EXTRA_DAYS, cal.get(Calendar.DAY_OF_MONTH));
intent.putExtra(AlarmClock.EXTRA_SKIP_UI, true);
startActivity(intent);
All this set very well the app alarm clock on my device regarding the time, but not for the date.
Example:
Current time: 12:00 Monday
Time from my code: 13:00 Saturday
The alarm clock sets to play (the ringtone) in 1 hour
Current time: 12:00 Monday
Time from my code: 11:00 Tuesday
The alarm clock sets to play (the ringtone) in 25 hours
I dont know how to use in particular this line of code:
intent.putExtra(AlarmClock.EXTRA_DAYS, cal.get(Calendar.DAY_OF_MONTH));
Thanks in advance