I need to run an application to run four times a day at specific time. I wrote this code and someone told me this is a bad way. I don't know if there is better ways to do that.
Intent myIntent = new Intent(this,MyService.class);
pendingIntent = PendingIntent.getService(this, 0,myIntent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 60);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 60*1000, pendingIntent);
It keeps calling the MyService every minute. Is there any way to run service at specific time?