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

Solved braodcast issue and notification issue through manifest changes. Now...

Solved braodcast issue and notification issue through manifest changes. Now sends notification however this is not yet fully functioning.
parent 8b55400d
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,11 @@ import com.example.pharmacy.frontEnd.R; ...@@ -18,6 +18,11 @@ import com.example.pharmacy.frontEnd.R;
public class SedentaryNotification extends Notification { public class SedentaryNotification extends Notification {
@Override
public int onStartCommand(Intent intent, int flags, int startId){
return super.onStartCommand(intent, flags, startId);
}
@Nullable @Nullable
@Override @Override
...@@ -28,7 +33,7 @@ public class SedentaryNotification extends Notification { ...@@ -28,7 +33,7 @@ public class SedentaryNotification extends Notification {
protected NotificationCompat.Builder setParameters(NotificationCompat.Builder builder) { protected NotificationCompat.Builder setParameters(NotificationCompat.Builder builder) {
//Get parameters from settings? or set strings? //Get parameters from settings? or set strings?
builder.setSmallIcon(0); builder.setSmallIcon(android.R.drawable.btn_star);
builder.setContentTitle(this.getClass().getName()); builder.setContentTitle(this.getClass().getName());
builder.setContentText(preferences.getString(getString(R.string.daily_goal_text), getString(R.string.notf_text))); builder.setContentText(preferences.getString(getString(R.string.daily_goal_text), getString(R.string.notf_text)));
builder.setCategory(NotificationCompat.CATEGORY_ALARM); builder.setCategory(NotificationCompat.CATEGORY_ALARM);
......
...@@ -68,7 +68,7 @@ public class SedentaryStimulus extends BroadcastReceiver implements Stimulus { ...@@ -68,7 +68,7 @@ public class SedentaryStimulus extends BroadcastReceiver implements Stimulus {
if(shared.getBoolean(context.getString(R.string.notf_switch), true)) { if(shared.getBoolean(context.getString(R.string.notf_switch), true)) {
Log.d("CALLBACK", "NOTIFICATION"); Log.d("CALLBACK", "NOTIFICATION");
Intent i = new Intent(context.getApplicationContext(), com.example.notification.Notification.class); Intent i = new Intent(context.getApplicationContext(), com.example.notification.SedentaryNotification.class);
context.getApplicationContext().startService(i); context.getApplicationContext().startService(i);
} }
//Restarts the chosen strategy process. //Restarts the chosen strategy process.
......
...@@ -55,7 +55,9 @@ public class Accelerometer extends Service implements StimulusStrategy, SensorEv ...@@ -55,7 +55,9 @@ public class Accelerometer extends Service implements StimulusStrategy, SensorEv
cal.add(Calendar.SECOND, 30); cal.add(Calendar.SECOND, 30);
Intent i = new Intent(getBaseContext(), com.example.stimulus.SedentaryStimulus.class); Intent i = new Intent(getBaseContext(), com.example.stimulus.SedentaryStimulus.class);
PendingIntent pi = PendingIntent.getBroadcast(getBaseContext(), R.integer.alarm_rc, i, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent pi = PendingIntent.getBroadcast(getBaseContext(), R.integer.alarm_rc, i, PendingIntent.FLAG_UPDATE_CURRENT);
//test
am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+3000, pi); am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+3000, pi);
//actual am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()+AlarmManager.INTERVAL_HOUR, pi);
Log.d("myTag", "ALARM SET" + am.toString()); Log.d("myTag", "ALARM SET" + am.toString());
} }
......
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