Here is my code:
cal.set(Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH, hourOfDay, minute,Calendar.SECOND); Intent intent=new Intent(FaceActivity.this,AlarmReceiver.class); PendingIntent pendingIntent=PendingIntent.getBroadcast(FaceActivity.this, 0, intent, 0); AlarmManager alarmManager=(AlarmManager) getSystemService(ALARM_SERVICE); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
Here hourOfDay is an hour before the current hour. a minute may have the same meaning.
Now here cal.getTimeInMillis () is set for a time that is one hour longer than the current time. But when I run this code, the broadcast receiver is called Immediately. Can anyone tell me what I'm doing wrong? Thanks at Advance ...
source share