I want to start multiple alarm inside BroadcastReceiver and starting service from that alarm but didn't start running. I was just tested it using context.startService(intent) and it was succeed. But somehow if i'm using alarmManager the service didn't start.
This is my code :
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
String weekDay;
SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE", Locale.US);
Calendar calendars = Calendar.getInstance();
weekDay = dayFormat.format(calendars.getTime());
//Toast.makeText(contexts,"Day : " + weekDay,Toast.LENGTH_SHORT).show();
for (int i=1; i< jArray; i++)
{
String hari = hari_list.get(i);
if (weekDay.equals(hari))
{
Intent intent = new Intent(contexts, Service3.class);
pendingIntent = PendingIntent.getBroadcast(contexts, i, intent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager manager = (AlarmManager) contexts.getSystemService(Context.ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY,8);
calendar.set(Calendar.MINUTE, 16);
calendar.set(Calendar.SECOND, 00);
manager.setExact(manager.RTC_WAKEUP,calendar.getTimeInMillis(),pendingIntent);
}
}
Could you help me ?