Added option to use mp3 notification sounds rather than tone generator to make alarm sounds
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
OpenSeizureDetector Android App - Change Log
|
||||
============================================
|
||||
|
||||
V2.5.4 - 03dec2017 - Added option to use either tone generator or MP3 alarm sound, as a user reported problem with tone generator on high end samsung phone.
|
||||
|
||||
V2.5.3 - 10sep2017 - Added Pebble App V2.6 which provides better alarm reliability
|
||||
- no changes to Android App other than first run dialog.
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 24
|
||||
buildToolsVersion '25.0.0'
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
|
||||
defaultConfig {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="uk.org.openseizuredetector"
|
||||
android:versionCode="37"
|
||||
android:versionName="2.5.3">
|
||||
android:versionCode="38"
|
||||
android:versionName="2.5.4">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
|
||||
@@ -45,7 +45,9 @@ import android.content.SharedPreferences;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.location.Location;
|
||||
import android.media.AudioManager;
|
||||
import android.media.RingtoneManager;
|
||||
import android.media.ToneGenerator;
|
||||
import android.net.Uri;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
@@ -56,7 +58,7 @@ import android.os.Looper;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.telephony.SmsManager;
|
||||
import android.location.Location;
|
||||
import android.util.Log;
|
||||
@@ -106,9 +108,10 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
||||
private int mLatchAlarmPeriod = 0;
|
||||
private LatchAlarmTimer mLatchAlarmTimer = null;
|
||||
private boolean mCancelAudible = false;
|
||||
public boolean mAudibleAlarm = false;
|
||||
public boolean mAudibleAlarm = false; // set to public because it is accessed by MainActivity
|
||||
private boolean mAudibleWarning = false;
|
||||
private boolean mAudibleFaultWarning = false;
|
||||
private boolean mMp3Alarm = false;
|
||||
private boolean mSMSAlarm = false;
|
||||
private String[] mSMSNumbers;
|
||||
private String mSMSMsgStr = "default SMS Message";
|
||||
@@ -516,7 +519,7 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
||||
/* from http://stackoverflow.com/questions/12154940/how-to-make-a-beep-in-android */
|
||||
|
||||
/**
|
||||
* beep for duration milliseconds, but only if mAudibleAlarm is set.
|
||||
* beep for duration milliseconds, using tone generator
|
||||
*/
|
||||
private void beep(int duration) {
|
||||
if (mToneGenerator != null) {
|
||||
@@ -561,7 +564,22 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
||||
Log.v(TAG, "alarmBeep() - CancelAudible Active - silent beep...");
|
||||
} else {
|
||||
if (mAudibleAlarm) {
|
||||
beep(3000);
|
||||
if (mMp3Alarm) {
|
||||
Log.v(TAG,"making MP3 alarm beep");
|
||||
// From https://stackoverflow.com/questions/4441334/how-to-play-an-android-notification-sound
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
//Define sound URI
|
||||
Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||
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);
|
||||
}
|
||||
Log.v(TAG, "alarmBeep()");
|
||||
mUtil.writeToSysLogFile("SdServer.alarmBeep() - beeping");
|
||||
} else {
|
||||
@@ -837,6 +855,9 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
|
||||
Log.v(TAG, "updatePrefs() - mAuidbleAlarm = " + mAudibleAlarm);
|
||||
mAudibleWarning = SP.getBoolean("AudibleWarning", true);
|
||||
Log.v(TAG, "updatePrefs() - mAuidbleWarning = " + mAudibleWarning);
|
||||
mMp3Alarm = SP.getBoolean("UseMp3Alarm", false);
|
||||
Log.v(TAG, "updatePrefs() - mMp3Alarm = " + mMp3Alarm);
|
||||
|
||||
mSMSAlarm = SP.getBoolean("SMSAlarm", false);
|
||||
Log.v(TAG, "updatePrefs() - mSMSAlarm = " + mSMSAlarm);
|
||||
String SMSNumberStr = SP.getString("SMSNumbers", "");
|
||||
|
||||
@@ -461,8 +461,8 @@ public class StartupActivity extends Activity {
|
||||
+ "http://openseizuredetector.org.uk, or the app Facebook page at https://www.facebook.com/openseizuredetector. "
|
||||
+ "so I can get in touch if necessary.\nThank you! Graham \ngraham@openseizuredetector.org.uk "
|
||||
+ "\n\nChanges in this version:"
|
||||
+ "\n- Upgraded Pebble watch app to V2.6, which improves alarm detection annunciation."
|
||||
+ "\n- Use the 'Install Watch App' menu option to upgrade the application on the watch."
|
||||
+ "\n- Added option to use MP3 alarm notification sounds rather than the default."
|
||||
+ "\n- as some users had reported the default sound not working."
|
||||
);
|
||||
// This makes the links display as links, but they do not respond to clicks for some reason...
|
||||
Linkify.addLinks(s, Linkify.ALL);
|
||||
@@ -492,10 +492,8 @@ public class StartupActivity extends Activity {
|
||||
+ "http://openseizuredetector.org.uk, or the app Facebook page at https://www.facebook.com/openseizuredetector. "
|
||||
+ "so I can get in touch if necessary.\nThank you! Graham \ngraham@openseizuredetector.org.uk "
|
||||
+ "\n\nChanges in this version:"
|
||||
+ "\n- Update to Detection Algorithm: You will need to increase the AlarmRatioThresh setting from the previous "
|
||||
+ "default of around 30 to a value of 50-60 to avoid excessive false alarms"
|
||||
+ "\n- Added GPS Location to SMS Alarms"
|
||||
+ "\n- Added auto-start on boot capability"
|
||||
+ "\n- Added option to use MP3 alarm notification sounds rather than the default."
|
||||
+ "\n- as some users had reported the default sound not working."
|
||||
);
|
||||
// This makes the links display as links, but they do not respond to clicks for some reason...
|
||||
Linkify.addLinks(s, Linkify.ALL);
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
android:summary="Duration that fault alarms are muted before initiating."
|
||||
android:numeric="integer"
|
||||
android:defaultValue="30" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="UseMp3Alarm"
|
||||
android:summary="Play an MP3 file to create the alarm beeps rather than using the default tone generator."
|
||||
android:title="Use MP3 Alarm Sound" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
}
|
||||
}
|
||||
allprojects {
|
||||
|
||||
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Sun May 07 14:37:42 BST 2017
|
||||
#Sun Dec 03 09:39:36 GMT 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
|
||||
Reference in New Issue
Block a user