package br.com.minhavia.minhavia.receive;

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

import br.com.minhavia.minhavia.service.FirebaseBackgroundService;
import br.com.minhavia.minhavia.service.PavimentoIrregularBackgroundService;

public class AlarmFirebaseReceive extends BroadcastReceiver {

    private static final String TAG = "MV-AlarmFirebaseReceive";

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG  , "onReceive()");
        Intent background = new Intent(context, FirebaseBackgroundService.class);
        Log.d(TAG  , "success onReceive()");
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            context.startForegroundService(background);
        } else {
            context.startService(background);
        }
    }
}