package com.sunzee.receiver;

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

import com.sunzee.service.MyService;

/**
 * @author whw
 * @time 2019/4/23
 * @Description 进程保活
 */
public class Alarmreceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
        if (intent!=null){
            if (intent.getAction()!=null){


            if (intent.getAction().equals("arui.alarm.action")) {
                Intent i = new Intent();
                i.setClass(context, MyService.class);
                // 启动service
                // 多次调用startService并不会启动多个service 而是会多次调用onStart
                context.startService(i);
            }
        }
        }

    }

}