First go at generating broadcasts to request openseizuredetector Dialler to generate phone call alerts.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
OpenSeizureDetector Android App - Change Log
|
OpenSeizureDetector Android App - Change Log
|
||||||
============================================
|
============================================
|
||||||
|
V3.5.0 - Aug 2020 Added broadcast to request phone call dial alert (handled by separate app OpenSeizureDetector Dialler).
|
||||||
|
|
||||||
V3.2.1 - Aug2020
|
V3.2.1 - Aug2020
|
||||||
- Addition of Spanish Translation, and correction of crash report wording in German.
|
- Addition of Spanish Translation, and correction of crash report wording in German.
|
||||||
V3.2.0 - mar2020
|
V3.2.0 - mar2020
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="uk.org.openseizuredetector"
|
package="uk.org.openseizuredetector"
|
||||||
android:versionCode="71"
|
android:versionCode="72"
|
||||||
android:versionName="3.2.1">
|
android:versionName="3.5.0">
|
||||||
<!-- android:allowBackup="false" -->
|
<!-- android:allowBackup="false" -->
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
|
|||||||
@@ -238,6 +238,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
mConnection.mSdServer.sendSMSAlarm();
|
mConnection.mSdServer.sendSMSAlarm();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.action_test_phone_alarm:
|
||||||
|
Log.i(TAG, "action_test_phone_alarm");
|
||||||
|
if (mConnection.mBound) {
|
||||||
|
mConnection.mSdServer.sendPhoneAlarm();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
case R.id.action_export:
|
case R.id.action_export:
|
||||||
Log.i(TAG, "action_export");
|
Log.i(TAG, "action_export");
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ public class OsdUtil implements ActivityCompat.OnRequestPermissionsResultCallbac
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPackageInstalled(String packagename) {
|
public boolean isPackageInstalled(String packagename) {
|
||||||
PackageManager pm = mContext.getPackageManager();
|
PackageManager pm = mContext.getPackageManager();
|
||||||
try {
|
try {
|
||||||
pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
|
pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
private boolean mAudibleWarning = false;
|
private boolean mAudibleWarning = false;
|
||||||
private boolean mAudibleFaultWarning = false;
|
private boolean mAudibleFaultWarning = false;
|
||||||
private boolean mMp3Alarm = false;
|
private boolean mMp3Alarm = false;
|
||||||
|
private boolean mPhoneAlarm = false;
|
||||||
private boolean mSMSAlarm = false;
|
private boolean mSMSAlarm = false;
|
||||||
private String[] mSMSNumbers;
|
private String[] mSMSNumbers;
|
||||||
private String mSMSMsgStr = "default SMS Message";
|
private String mSMSMsgStr = "default SMS Message";
|
||||||
@@ -457,6 +458,9 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
} else {
|
} else {
|
||||||
smsStr = getString(R.string.sms_location_alarm_disabled);
|
smsStr = getString(R.string.sms_location_alarm_disabled);
|
||||||
}
|
}
|
||||||
|
if (mPhoneAlarm) {
|
||||||
|
smsStr = "Phone Call Alarm Active";
|
||||||
|
}
|
||||||
if (mNotificationBuilder != null) {
|
if (mNotificationBuilder != null) {
|
||||||
mNotification = mNotificationBuilder.setContentIntent(contentIntent)
|
mNotification = mNotificationBuilder.setContentIntent(contentIntent)
|
||||||
.setSmallIcon(iconId)
|
.setSmallIcon(iconId)
|
||||||
@@ -565,6 +569,7 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
- mSMSTime.toMillis(false))
|
- mSMSTime.toMillis(false))
|
||||||
> 60000) {
|
> 60000) {
|
||||||
sendSMSAlarm();
|
sendSMSAlarm();
|
||||||
|
sendPhoneAlarm();
|
||||||
mSMSTime = tnow;
|
mSMSTime = tnow;
|
||||||
} else {
|
} else {
|
||||||
mUtil.showToast("SMS Alarm already sent - not re-sending");
|
mUtil.showToast("SMS Alarm already sent - not re-sending");
|
||||||
@@ -794,6 +799,18 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
Log.i(TAG, "sendSMSAlarm() - SMS Alarms Disabled - not doing anything!");
|
Log.i(TAG, "sendSMSAlarm() - SMS Alarms Disabled - not doing anything!");
|
||||||
mUtil.showToast(getString(R.string.sms_alarm_disabled));
|
mUtil.showToast(getString(R.string.sms_alarm_disabled));
|
||||||
}
|
}
|
||||||
|
if (mPhoneAlarm) {
|
||||||
|
if (!mCancelAudible) {
|
||||||
|
Log.i(TAG, "sendSMSAlarm() - Sending Phone Alarm Broadcast");
|
||||||
|
sendPhoneAlarm();
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "sendSMSAlarm() - Cancel Audible Active - not making Phone Call");
|
||||||
|
mUtil.showToast(getString(R.string.cancel_audible_not_sending_sms));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "sendSMSAlarm() - Phone Alarms Disabled - not doing anything!");
|
||||||
|
mUtil.showToast(getString(R.string.phone_alarm_disabled));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1068,6 +1085,8 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
|
|
||||||
mSMSAlarm = SP.getBoolean("SMSAlarm", false);
|
mSMSAlarm = SP.getBoolean("SMSAlarm", false);
|
||||||
Log.v(TAG, "updatePrefs() - mSMSAlarm = " + mSMSAlarm);
|
Log.v(TAG, "updatePrefs() - mSMSAlarm = " + mSMSAlarm);
|
||||||
|
mPhoneAlarm = SP.getBoolean("PhoneCallAlarm", false);
|
||||||
|
Log.v(TAG, "updatePrefs() - mSMSAlarm = " + mSMSAlarm);
|
||||||
String SMSNumberStr = SP.getString("SMSNumbers", "");
|
String SMSNumberStr = SP.getString("SMSNumbers", "");
|
||||||
mSMSNumbers = SMSNumberStr.split(",");
|
mSMSNumbers = SMSNumberStr.split(",");
|
||||||
mSMSMsgStr = SP.getString("SMSMsg", "Seizure Detected!!!");
|
mSMSMsgStr = SP.getString("SMSMsg", "Seizure Detected!!!");
|
||||||
@@ -1153,7 +1172,16 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void sendPhoneAlarm() {
|
||||||
|
/**
|
||||||
|
* Use the separate OpenSeizureDetector Dialler app to generate a phone call alarm to the numbers selected for SMS Alarms.
|
||||||
|
*/
|
||||||
|
Log.v(TAG,"sendPhoneAlarm() - sending broadcast intent");
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setAction("uk.org.openseizuredetector.dialler.ALARM");
|
||||||
|
intent.putExtra("NUMBERS",mSMSNumbers);
|
||||||
|
sendBroadcast(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
|
import android.text.SpannedString;
|
||||||
import android.text.util.Linkify;
|
import android.text.util.Linkify;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -225,11 +226,13 @@ public class StartupActivity extends Activity {
|
|||||||
TextView tv;
|
TextView tv;
|
||||||
ProgressBar pb;
|
ProgressBar pb;
|
||||||
boolean smsAlarmsActive = true;
|
boolean smsAlarmsActive = true;
|
||||||
|
boolean phoneAlarmsActive = true;
|
||||||
|
|
||||||
Log.v(TAG,"serverStatusRunnable()");
|
Log.v(TAG,"serverStatusRunnable()");
|
||||||
SharedPreferences SP = PreferenceManager
|
SharedPreferences SP = PreferenceManager
|
||||||
.getDefaultSharedPreferences(getBaseContext());
|
.getDefaultSharedPreferences(getBaseContext());
|
||||||
smsAlarmsActive = SP.getBoolean("SMSAlarm", false);
|
smsAlarmsActive = SP.getBoolean("SMSAlarm", false);
|
||||||
|
phoneAlarmsActive = SP.getBoolean("PhoneCallAlarm", false);
|
||||||
|
|
||||||
// Settings ok
|
// Settings ok
|
||||||
tv = (TextView) findViewById(R.id.textItem1);
|
tv = (TextView) findViewById(R.id.textItem1);
|
||||||
@@ -258,6 +261,16 @@ public class StartupActivity extends Activity {
|
|||||||
mUtil.requestPermissions(StartupActivity.this);
|
mUtil.requestPermissions(StartupActivity.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If phone alarms are selected, we need to have the uk.org.openseizuredetector.dialler package installed to do the actual dialling.
|
||||||
|
if (phoneAlarmsActive && !mUtil.isPackageInstalled("uk.org.openseizuredetector.dialler")) {
|
||||||
|
tv.setText(getText(R.string.DiallerNotInstalledWarning));
|
||||||
|
tv.setBackgroundColor(alarmColour);
|
||||||
|
tv.setTextColor(alarmTextColour);
|
||||||
|
pb.setIndeterminateDrawable(getResources().getDrawable(R.drawable.start_server));
|
||||||
|
pb.setProgressDrawable(getResources().getDrawable(R.drawable.start_server));
|
||||||
|
allOk = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Are we Bound to the Service
|
// Are we Bound to the Service
|
||||||
tv = (TextView) findViewById(R.id.textItem2);
|
tv = (TextView) findViewById(R.id.textItem2);
|
||||||
pb = (ProgressBar) findViewById(R.id.progressBar2);
|
pb = (ProgressBar) findViewById(R.id.progressBar2);
|
||||||
|
|||||||
@@ -46,6 +46,12 @@
|
|||||||
android:showAsAction="never|withText"
|
android:showAsAction="never|withText"
|
||||||
android:title="@string/test_sms_alarm_notification" />
|
android:title="@string/test_sms_alarm_notification" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_test_phone_alarm"
|
||||||
|
android:icon="@drawable/stop_server"
|
||||||
|
android:showAsAction="never|withText"
|
||||||
|
android:title="@string/test_phone_alarm_notification" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_logmanager"
|
android:id="@+id/action_logmanager"
|
||||||
android:icon="@drawable/ic_action_settings"
|
android:icon="@drawable/ic_action_settings"
|
||||||
|
|||||||
@@ -139,5 +139,8 @@
|
|||||||
<string name="send_sms_last_location">Send SMS - last location is </string>
|
<string name="send_sms_last_location">Send SMS - last location is </string>
|
||||||
<string name="failed_to_send_sms">ERROR: FAILED TO SEND SMS MESSAGE</string>
|
<string name="failed_to_send_sms">ERROR: FAILED TO SEND SMS MESSAGE</string>
|
||||||
<string name="sms_alarms_disabled">SMS Alarms Disabled - not doing anything!</string>
|
<string name="sms_alarms_disabled">SMS Alarms Disabled - not doing anything!</string>
|
||||||
|
<string name="phone_alarm_disabled">Phone Alarm Disabled</string>
|
||||||
|
<string name="test_phone_alarm_notification">Test Phone Alarm</string>
|
||||||
|
<string name="DiallerNotInstalledWarning"><a href="https://github.com/OpenSeizureDetector/Dialler/tree/master/app/release/app-release.apk">OpenSeizureDetector Dialer App</a> Not installed - Required for Phone Call Alerts.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -62,6 +62,14 @@
|
|||||||
android:title="SMS Message" />
|
android:title="SMS Message" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory android:title="Phone Call Alarm Settings">
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="PhoneCallAlarm"
|
||||||
|
android:summary="Dial the Carer(s) phone number(s) as well as sending SMS alerts. It requests an external application (OpenSeizureDetector Dialler) to make the phone calls to the same numbers as are set for SMS alerts above"
|
||||||
|
android:title="Enable Phone Call Alarm" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="Alarm Logging">
|
<PreferenceCategory android:title="Alarm Logging">
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
|
|||||||
BIN
doc/diagram-e1597608646928-1024x514.png
Normal file
BIN
doc/diagram-e1597608646928-1024x514.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 140 KiB |
BIN
doc/diagram.jpg
Normal file
BIN
doc/diagram.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
BIN
doc/diagram.odg
Normal file
BIN
doc/diagram.odg
Normal file
Binary file not shown.
BIN
doc/diagram.png
Normal file
BIN
doc/diagram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
BIN
doc/diagram_1024x500.png
Normal file
BIN
doc/diagram_1024x500.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 149 KiB |
Reference in New Issue
Block a user