Newer
Older

Peter Joseph De Jonckheere CESM2014
committed
package com.example.stimulusStrategy;

Peter Joseph De Jonckheere CESM2014
committed
import android.app.AlarmManager;
import android.app.PendingIntent;

Peter Joseph De Jonckheere CESM2014
committed
import android.app.Service;

Peter Joseph De Jonckheere CESM2014
committed
import android.content.Context;
import android.content.Intent;

Peter Joseph De Jonckheere CESM2014
committed
import android.os.IBinder;
import android.support.annotation.Nullable;

Peter Joseph De Jonckheere CESM2014
committed

Peter Joseph De Jonckheere CESM2014
committed
import com.example.notification.Notification;

Peter Joseph De Jonckheere CESM2014
committed
/**
* Created by pharmacy on 09/01/2018.
*/

Peter Joseph De Jonckheere CESM2014
committed
public class Clock extends Service implements StimulusStrategy {

Peter Joseph De Jonckheere CESM2014
committed

Peter Joseph De Jonckheere CESM2014
committed
@Override
public void onCreate(){
monitor();

Peter Joseph De Jonckheere CESM2014
committed
}

Peter Joseph De Jonckheere CESM2014
committed

Peter Joseph De Jonckheere CESM2014
committed
public void monitor() {
//Does intent require parameters??
//Similar for pending intent??

Peter Joseph De Jonckheere CESM2014
committed
//Intent should also be configured here to set up notification properly
AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
Intent i = new Intent(this, Notification.class);
PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0);

Peter Joseph De Jonckheere CESM2014
committed
am.set(AlarmManager.ELAPSED_REALTIME, AlarmManager.INTERVAL_HOUR, pi);

Peter Joseph De Jonckheere CESM2014
committed
}

Peter Joseph De Jonckheere CESM2014
committed
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}