diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3194086..c6e99d9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ + runningTaskInfo = manager.getRunningTasks(1); + ComponentName componentInfo = runningTaskInfo.get(0).topActivity; + + if (componentInfo.getPackageName().equals("uk.org.openseizuredetector")) { + Log.v(TAG,"showMainActivity(): OpenSeizureDetector Activity is already shown on top - not doing anything"); + } else { + Log.v(TAG,"showMainActivity(): Showing Main Activity"); + Intent i = new Intent(getApplicationContext(), MainActivity.class); + i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK); + this.startActivity(i); + } } /** @@ -321,6 +350,7 @@ public class SdServer extends Service implements SdDataReceiver { sdData.alarmPhrase = "OK"; sdData.alarmStanding = false; sdData.fallAlarmStanding = false; + showNotification(0); } } if (sdData.alarmState == 1) { @@ -339,6 +369,7 @@ public class SdServer extends Service implements SdDataReceiver { Log.v(TAG, "WARNING"); } warningBeep(); + showNotification(1); } if ((sdData.alarmState == 2) || (sdData.alarmStanding)) { sdData.alarmPhrase = "ALARM"; @@ -352,6 +383,7 @@ public class SdServer extends Service implements SdDataReceiver { } // Make alarm beep tone alarmBeep(); + showNotification(2); // Display MainActvity showMainActivity(); // Send SMS Alarm. @@ -460,7 +492,7 @@ public class SdServer extends Service implements SdDataReceiver { Log.v(TAG, "alarmBeep() - CancelAudible Active - silent beep..."); } else { if (mAudibleAlarm) { - beep(1000); + beep(3000); Log.v(TAG, "alarmBeep()"); } else { Log.v(TAG, "alarmBeep() - silent..."); @@ -716,9 +748,9 @@ public class SdServer extends Service implements SdDataReceiver { } /* - * Temporary cancel audible alarms, for the period specified by the - * CancelAudiblePeriod setting. - */ + * Temporary cancel audible alarms, for the period specified by the + * CancelAudiblePeriod setting. + */ private class CancelAudibleTimer extends CountDownTimer { public CancelAudibleTimer(long startTime, long interval) { super(startTime, interval); diff --git a/app/src/main/res/drawable/star_of_life_red_24x24.png b/app/src/main/res/drawable/star_of_life_red_24x24.png new file mode 100644 index 0000000..22175c7 Binary files /dev/null and b/app/src/main/res/drawable/star_of_life_red_24x24.png differ diff --git a/app/src/main/res/drawable/star_of_life_yellow_24x24.png b/app/src/main/res/drawable/star_of_life_yellow_24x24.png new file mode 100644 index 0000000..2e8fcf2 Binary files /dev/null and b/app/src/main/res/drawable/star_of_life_yellow_24x24.png differ