Skip to content
Snippets Groups Projects
BootLauncher.java 1.04 KiB
Newer Older
package com.notificationFramework.stimulus;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import com.notificationFramework.stimulusStrategy.Accelerometer;
import com.notificationFramework.stimulusStrategy.SigMotionDetect;
 * Created by Peter De Jonckheere on 12/02/2018.
 */

public class BootLauncher extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
           SensorManager sm = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
            if (sm.getDefaultSensor(Sensor.TYPE_STEP_COUNTER) != null) {
                Stimulus stimulus = new SedentaryStimulus(context.getApplicationContext(), new SigMotionDetect());
                Stimulus stimulus = new SedentaryStimulus(context.getApplicationContext(), new Accelerometer());