package com.revoapp.calendar.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.revoapp.api.helper.BroadcastHelper;
import com.revoapp.api.logger.RevoLogger;
import com.revoapp.calendar.service.EventAlarmServices;
import com.revoapp.calendar.service.PillsAlarmServices;

public class BootReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String intentAction = intent.getAction();
        RevoLogger.log(RevoLogger.VERBOSE, this.getClass().getName(),
                "onReceive", "action = " + intentAction);

        if (intentAction.equals(BroadcastHelper.ACTION_BOOT_COMPLETED)) {
            Intent eventService = new Intent(context, EventAlarmServices.class);
            eventService.setAction(EventAlarmServices.CREATE);
            context.startService(eventService);

            Intent servicePills = new Intent(context, PillsAlarmServices.class);
            servicePills.setAction(PillsAlarmServices.CREATE);
            context.startService(servicePills);
        }
    }
}