V2.5.4 - Added audio alarm notifications as an alternative to tone generator.
This commit is contained in:
@@ -43,6 +43,8 @@ Logo based on ["Star of life2" by Verdy p - Own work. Licensed under Public Doma
|
||||
|
||||
Other icons crated using http://romannurik.github.io/AndroidAssetStudio.
|
||||
|
||||
Audio Alarm sounds from freesound https://freesound.org/people/coltonmanz/sounds/381382/, https://freesound.org/people/NoiseCollector/sounds/4270/, https://freesound.org/people/pistak23/sounds/271632/
|
||||
|
||||
|
||||
Graham Jones, 01 March 2015. (grahamjones139+sd@gmail.com)
|
||||
|
||||
Graham Jones, 03 December 2017. (grahamjones139+sd@gmail.com)
|
||||
|
||||
BIN
app/release/app-release-2.5.3.apk
Normal file
BIN
app/release/app-release-2.5.3.apk
Normal file
Binary file not shown.
BIN
app/release/app-release-2.5.4.apk
Normal file
BIN
app/release/app-release-2.5.4.apk
Normal file
Binary file not shown.
BIN
app/release/app-release.apk
Normal file
BIN
app/release/app-release.apk
Normal file
Binary file not shown.
1
app/release/output.json
Normal file
1
app/release/output.json
Normal file
@@ -0,0 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":38},"path":"app-release.apk","properties":{"packageId":"uk.org.openseizuredetector","split":"","minSdkVersion":"14"}}]
|
||||
@@ -541,7 +541,20 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
||||
Log.v(TAG, "faultWarningBeep() - CancelAudible Active - silent beep...");
|
||||
} else {
|
||||
if (mAudibleFaultWarning) {
|
||||
beep(10);
|
||||
if (mMp3Alarm) {
|
||||
Log.v(TAG,"making MP3 alarm beep");
|
||||
// From https://stackoverflow.com/questions/4441334/how-to-play-an-android-notification-sound
|
||||
// This plays an audio file as a notification, using the notification sound channel.
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
Uri soundUri = Uri.parse("android.resource://"+getPackageName()+"/raw/fault");
|
||||
NotificationCompat.Builder mBuilder =
|
||||
new NotificationCompat.Builder(getApplicationContext())
|
||||
.setSound(soundUri); //This sets the sound to play
|
||||
notificationManager.notify(0, mBuilder.build());
|
||||
} else {
|
||||
beep(10);
|
||||
}
|
||||
Log.v(TAG, "faultWarningBeep()");
|
||||
mUtil.writeToSysLogFile("SdServer.faultWarningBeep() - beeping");
|
||||
} else {
|
||||
@@ -567,15 +580,13 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
||||
if (mMp3Alarm) {
|
||||
Log.v(TAG,"making MP3 alarm beep");
|
||||
// From https://stackoverflow.com/questions/4441334/how-to-play-an-android-notification-sound
|
||||
// This plays an audio file as a notification, using the notification sound channel.
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
//Define sound URI
|
||||
Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||
Uri soundUri = Uri.parse("android.resource://"+getPackageName()+"/raw/alarm");
|
||||
NotificationCompat.Builder mBuilder =
|
||||
new NotificationCompat.Builder(getApplicationContext())
|
||||
.setSound(soundUri); //This sets the sound to play
|
||||
|
||||
//Display notification
|
||||
notificationManager.notify(0, mBuilder.build());
|
||||
} else {
|
||||
beep(3000);
|
||||
@@ -596,7 +607,20 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
||||
Log.v(TAG, "warningBeep() - CancelAudible Active - silent beep...");
|
||||
} else {
|
||||
if (mAudibleWarning) {
|
||||
beep(100);
|
||||
if (mMp3Alarm) {
|
||||
Log.v(TAG,"making MP3 alarm beep");
|
||||
// From https://stackoverflow.com/questions/4441334/how-to-play-an-android-notification-sound
|
||||
// This plays an audio file as a notification, using the notification sound channel.
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
Uri soundUri = Uri.parse("android.resource://"+getPackageName()+"/raw/warning");
|
||||
NotificationCompat.Builder mBuilder =
|
||||
new NotificationCompat.Builder(getApplicationContext())
|
||||
.setSound(soundUri); //This sets the sound to play
|
||||
notificationManager.notify(0, mBuilder.build());
|
||||
} else {
|
||||
beep(100);
|
||||
}
|
||||
Log.v(TAG, "warningBeep()");
|
||||
mUtil.writeToSysLogFile("SdServer.warningBeep() - beeping");
|
||||
} else {
|
||||
|
||||
BIN
app/src/main/res/raw/alarm.wav
Normal file
BIN
app/src/main/res/raw/alarm.wav
Normal file
Binary file not shown.
BIN
app/src/main/res/raw/fault.mp3
Normal file
BIN
app/src/main/res/raw/fault.mp3
Normal file
Binary file not shown.
BIN
app/src/main/res/raw/warning.wav
Normal file
BIN
app/src/main/res/raw/warning.wav
Normal file
Binary file not shown.
Reference in New Issue
Block a user