Skip to content
Snippets Groups Projects
Commit 6dc222d0 authored by Peter Joseph De Jonckheere CESM2014's avatar Peter Joseph De Jonckheere CESM2014
Browse files

More additions

parent 7da0fdef
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,8 @@ import com.notificationFramework.sedentary.frontEnd.NotificationClicked;
import com.notificationFramework.sedentary.frontEnd.R;
import com.notificationFramework.sedentary.frontEnd.SaveFile;
import java.util.Random;
/**
* Created by Peter De Jonckheere on 09/01/2018.
* <p>
......@@ -36,7 +38,7 @@ public abstract class Notification extends Service {
/**
* Arbitrary integer for the id of the notification
*/
protected int snId = 0;
protected int snId = this.getResources().getInteger(R.integer.notf_id);
/**
* Instance of SharedPreferences which allows access to information saved in
* sedentary.FrontEnd.Settings needed to determine the properties of the notification to
......
package com.notificationFramework.sedentary.frontEnd;
import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
......@@ -27,7 +28,12 @@ public class DataAnalysis {
}
compCal.add(Calendar.MINUTE, -6);
if (compCal.before(cal.getTime())) {
//Remove notification
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
try {
nm.cancel(context.getResources().getInteger(R.integer.notf_id));
} catch(NullPointerException e){
Log.i("NOTIFICATION", "NOTIFICATION WAS CLICKED ON");
}
//Give new notification saying well done?
logAcknowledgement(context);
return true;
......
......@@ -4,4 +4,5 @@
<integer name="notify_period_minutes">60</integer>
<integer name="step_job">1</integer>
<integer name="alarm_rc">23</integer>
<integer name="notf_id">1240</integer>
</resources>
\ No newline at end of file
......@@ -46,4 +46,5 @@
<string name="ack_total">Acknowledgement Total</string>
<string name="ack_days">Acknowledgement Day Count</string>
<string name="avg_ack">Acknowledgements per day</string>
<string name="notf_id">Notification ID</string>
</resources>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment