package com.sunzee.receiver;

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

import com.sunzee.model.domain.Name;
import com.sunzee.model.message.ApiMessageEvent;
import com.sunzee.utils.AlarmManagerUtil;

import org.greenrobot.eventbus.EventBus;

/**
 * 监听并启动定时清洗任务广播.
 */
public class TimedCleaningTaskAlarmReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        long intervalMillis = intent.getLongExtra("intervalMillis", 0);
        if (intervalMillis != 0) {
            AlarmManagerUtil.setAlarmTime(context, System.currentTimeMillis() + intervalMillis,
                    intent);
        }
        //推送myservice开始清洗
        EventBus.getDefault().post(new ApiMessageEvent(Name.STARTCLEAN, "闹钟响了26"));
    }


}
