I must set the alarm to 10:35 even application created. But when I setted this time. My application firing alarm because date is past. I have to set 10:35. If date is past, I want to start next day at 10:35. How can I do that?
My code:
Intent intent = new Intent(MainActivity.this, Alarm.class);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.HOUR_OF_DAY, 10);
calendar.set(Calendar.MINUTE, 35);
calendar.set(Calendar.SECOND, 40);
PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 234, intent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);