V2.6.1 - Explicitly request SMS permission, and provide warnings in notification if active.

This commit is contained in:
Graham Jones
2019-01-27 21:31:22 +00:00
parent 6d5771181f
commit eb703fe03e
4 changed files with 38 additions and 29 deletions

Binary file not shown.

View File

@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":42,"versionName":"2.6.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":43,"versionName":"2.6.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

View File

@@ -747,34 +747,39 @@ public class SdServer extends Service implements SdDataReceiver, SdLocationRecei
*/ */
public void sendSMSAlarm() { public void sendSMSAlarm() {
if (mSMSAlarm) { if (mSMSAlarm) {
mLocationFinder.getLocation(this); if (!mUtil.areSMSPermissionsOK()) {
Location loc = mLocationFinder.getLastLocation(); mUtil.showToast("ERROR - Permission for SMS or Location Denied - Not Sending SMS");
if (loc != null) { Log.e(TAG,"ERROR - Permission for SMS or Location Denied - Not Sending SMS");
mUtil.showToast("Send SMS - last location is "
+ loc.getLongitude() + ","
+ loc.getLatitude());
} else { } else {
Log.i(TAG, "sendSMSAlarm() - Last Location is Null so sending first SMS without location."); mLocationFinder.getLocation(this);
} Location loc = mLocationFinder.getLastLocation();
Log.i(TAG, "sendSMSAlarm() - Sending to " + mSMSNumbers.length + " Numbers"); if (loc != null) {
mUtil.writeToSysLogFile("SdServer.sendSMSAlarm()"); mUtil.showToast("Send SMS - last location is "
Time tnow = new Time(Time.getCurrentTimezone()); + loc.getLongitude() + ","
tnow.setToNow(); + loc.getLatitude());
String dateStr = tnow.format("%H:%M:%S %d/%m/%Y"); } else {
// SmsManager sm = SmsManager.getDefault(); Log.i(TAG, "sendSMSAlarm() - Last Location is Null so sending first SMS without location.");
for (int i = 0; i < mSMSNumbers.length; i++) { }
Log.i(TAG, "sendSMSAlarm() - Sending to " + mSMSNumbers[i]); Log.i(TAG, "sendSMSAlarm() - Sending to " + mSMSNumbers.length + " Numbers");
sendSMS(new String(mSMSNumbers[i]),mSMSMsgStr + " - " + dateStr); mUtil.writeToSysLogFile("SdServer.sendSMSAlarm()");
// sm.sendTextMessage(mSMSNumbers[i], null, mSMSMsgStr + " - " + dateStr, null, null); Time tnow = new Time(Time.getCurrentTimezone());
//Intent intent = new Intent(Intent.ACTION_SEND); tnow.setToNow();
//intent.setDataAndType(Uri.parse("smsto:"), "text/plain"); String dateStr = tnow.format("%H:%M:%S %d/%m/%Y");
//intent.putExtra("sms_body", mSMSMsgStr + " - " + dateStr); // SmsManager sm = SmsManager.getDefault();
//intent.putExtra("address", new String(mSMSNumbers[i])); for (int i = 0; i < mSMSNumbers.length; i++) {
//if (intent.resolveActivity(getPackageManager()) != null) { Log.i(TAG, "sendSMSAlarm() - Sending to " + mSMSNumbers[i]);
// startActivity(intent); sendSMS(new String(mSMSNumbers[i]), mSMSMsgStr + " - " + dateStr);
//} else { // sm.sendTextMessage(mSMSNumbers[i], null, mSMSMsgStr + " - " + dateStr, null, null);
// Log.e(TAG, "sendSMSAlarm() - Failed to send SMS - can not find activity do do it"); //Intent intent = new Intent(Intent.ACTION_SEND);
//} //intent.setDataAndType(Uri.parse("smsto:"), "text/plain");
//intent.putExtra("sms_body", mSMSMsgStr + " - " + dateStr);
//intent.putExtra("address", new String(mSMSNumbers[i]));
//if (intent.resolveActivity(getPackageManager()) != null) {
// startActivity(intent);
//} else {
// Log.e(TAG, "sendSMSAlarm() - Failed to send SMS - can not find activity do do it");
//}
}
} }
} else { } else {
Log.i(TAG, "sendSMSAlarm() - SMS Alarms Disabled - not doing anything!"); Log.i(TAG, "sendSMSAlarm() - SMS Alarms Disabled - not doing anything!");

View File

@@ -491,6 +491,8 @@ public class StartupActivity extends Activity {
+ "\n\nChanges in this version:" + "\n\nChanges in this version:"
+ "\n- Upgraded to be compatible with Android Version 8 (a requirement of Google Play Store)" + "\n- Upgraded to be compatible with Android Version 8 (a requirement of Google Play Store)"
+ "\n- Added support for an experimental Gramin based seizure detector with Heart Rate alarm " + "\n- Added support for an experimental Gramin based seizure detector with Heart Rate alarm "
+ "\n Fixed problem with app not restarting properly when settings were changed"
+ "\n- Explicitly asks for SMS permission, and displays warning in notification if SMS alarms are active"
+ "\n " + "\n "
+ "\n PLEASE NOTE - THIS IS A BETA TEST VERSION SO MAY NOT WORK!" + "\n PLEASE NOTE - THIS IS A BETA TEST VERSION SO MAY NOT WORK!"
+ "\n ." + "\n ."
@@ -525,9 +527,11 @@ public class StartupActivity extends Activity {
+ "\n\nChanges in this version:" + "\n\nChanges in this version:"
+ "\n- Upgraded to be compatible with Android Version 8 (a requirement of Google Play Store)" + "\n- Upgraded to be compatible with Android Version 8 (a requirement of Google Play Store)"
+ "\n- Added support for an experimental Gramin based seizure detector with Heart Rate alarm " + "\n- Added support for an experimental Gramin based seizure detector with Heart Rate alarm "
+ "\n- Fixed problem with app not restarting properly when settings were changed"
+ "\n- Explicitly asks for SMS permission, and displays warning in notification if SMS alarms are active"
+ "\n " + "\n "
+ "\n PLEASE NOTE - THIS IS A BETA TEST VERSION SO MAY NOT WORK!" + "\n PLEASE NOTE - THIS IS A BETA TEST VERSION SO MAY NOT WORK!"
+ "\n- " + "\n "
); );
// This makes the links display as links, but they do not respond to clicks for some reason... // This makes the links display as links, but they do not respond to clicks for some reason...
Linkify.addLinks(s, Linkify.ALL); Linkify.addLinks(s, Linkify.ALL);