package com.sudi.plan.it.notifications;

import com.sudi.plan.it.models.TaskDbHelper;

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

public class AlarmReceiver extends BroadcastReceiver {
	
	TaskDbHelper dbHelper;

	@Override
	public void onReceive(Context context, Intent intent) {
		Log.d("PlanIt.Debug", "Received Alarm");
		dbHelper = new TaskDbHelper(context);
		long task_id = intent.getLongExtra("task_id", -1);

		NotificationCreator notification = new NotificationCreator(context);
		if (task_id != -1)
			notification.notify(dbHelper.getTask(task_id));
	}

}

@@ -641,14 +641,103 @@
 k_id));%0A
+%09%09%0A%09%09Notifier notifier = new Notifier(context, dbHelper);%0A%09%09notifier.setNextAlarm(null);%0A
 %09%7D%0A%0A%7D%0A

set new alarm when alarm is received