I have set up a notitication using setRepeating with AlarmManager and when testing I noticed that the repeating process waits 5 minutes to send a notification when it should fire it every minute. I believe its me who isnt doing something correctly. Could anybody please look ay my code below and point me in the right direction? Thank you.
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.HOUR_OF_DAY,calendar.get(Calendar.HOUR_OF_DAY) );
calendar.add(Calendar.MINUTE, calendar.get(Calendar.MINUTE));
SimpleDateFormat sdf = new
SimpleDateFormat("yyyy-MM-dd hh:mm:ss a");
String date = sdf.format(calendar.getTime());
Date date1 = calendar.getTime();
long differenceInMillis = date1.getTime();
System.out.println("dates are " +date1);
Toast.makeText(getApplicationContext(), "Alarma Set", Toast.LENGTH_LONG).show();
Intent intent = new Intent(MainActivity.this, BroadcastReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.this,0,intent,0);
AlarmManager alarmManager =(AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, timeAtButtonClick/1000, 1000 * 60 * 1, pendingIntent);