Added FOREGROUND_SERVICE permission, which seems to be needed for Android 9 or it crashes with a 'Permission Denied' error.

This commit is contained in:
Graham Jones
2019-02-11 21:11:08 +00:00
parent 3221775899
commit 81090da2dc
6 changed files with 28 additions and 11 deletions

Binary file not shown.

View File

@@ -1 +1 @@
[{"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":{}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":44,"versionName":"2.6.2","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

View File

@@ -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="43"
android:versionName="2.6.1"
android:versionCode="44"
android:versionName="2.6.2"
android:allowBackup="false"
>
@@ -16,8 +16,9 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-feature
android:name="android.hardware.telephony"

View File

@@ -40,6 +40,7 @@ import org.json.JSONArray;
public class SdData implements Parcelable {
private final static String TAG = "SdData";
private final static int N_RAW_DATA = 500; // 5 seconds at 100 Hz.
/* Analysis settings */
public boolean haveSettings = false; // flag to say if we have received settings or not.
public boolean haveData = false; // flag to say we have received data.
@@ -67,6 +68,7 @@ public class SdData implements Parcelable {
public boolean mHRAlarmActive = false;
public double mHRThreshMin = 40.0;
public double mHRTreshMax = 150.0;
public int rawData[];
/* Analysis results */
public Time dataTime = null;
@@ -88,6 +90,7 @@ public class SdData implements Parcelable {
public SdData() {
simpleSpec = new int[10];
rawData = new int[N_RAW_DATA];
dataTime = new Time(Time.getCurrentTimezone());
}
@@ -118,6 +121,7 @@ public class SdData implements Parcelable {
alarmPhrase = jo.optString("alarmPhrase");
alarmThresh = jo.optInt("alarmThresh");
alarmRatioThresh = jo.optInt("alarmRatioThresh");
mHR = jo.optDouble("hr");
JSONArray specArr = jo.optJSONArray("simpleSpec");
for (int i = 0; i < specArr.length(); i++) {
simpleSpec[i] = specArr.optInt(i);
@@ -131,12 +135,12 @@ public class SdData implements Parcelable {
}
}
@Override
public String toString() {
return toDataString();
return toDataString(false);
}
public String toDataString() {
public String toDataString(boolean includeRawData) {
String retval;
retval = "SdData.toDataString() Output";
try {
@@ -166,12 +170,18 @@ public class SdData implements Parcelable {
jsonObj.put("alarmFreqMax",alarmFreqMax);
jsonObj.put("alarmThresh", alarmThresh);
jsonObj.put("alarmRatioThresh", alarmRatioThresh);
jsonObj.put("hr",mHR);
JSONArray arr = new JSONArray();
for (int i = 0; i < simpleSpec.length; i++) {
arr.put(simpleSpec[i]);
}
jsonObj.put("simpleSpec", arr);
if (includeRawData) {
JSONArray rawArr = new JSONArray();
for (int i = 0; i< rawData.length;i++) {
rawArr.put(rawData[i]);
}
}
retval = jsonObj.toString();
} catch (Exception ex) {

View File

@@ -441,11 +441,15 @@ public class SdDataSourcePebble extends SdDataSource {
Log.v(TAG, "numSamples = " + numSamples);
byte[] rawDataBytes = data.getBytes(KEY_RAW_DATA);
for (int i = 0; i < rawDataBytes.length - 4; i += 4) { // 4 bytes per sample
int x = (rawDataBytes[i]);
int b0 = rawDataBytes[i];
int b1 = rawDataBytes[i+1] & 0xff;
int b2 = rawDataBytes[i+2] & 0xff;
int b3 = rawDataBytes[i+3] & 0xff;
int x = (b3 | b2 << 8 | b1 << 16 | b0 << 24);
//int y = (rawDataBytes[i+2] & 0xff) | (rawDataBytes[i+3] << 8);
//int z = (rawDataBytes[i+4] & 0xff) | (rawDataBytes[i+5] << 8);
//Log.v(TAG,"x="+x+", y="+y+", z="+z);
Log.v(TAG,"x="+x);
Log.v(TAG,"b0="+b0+", b1="+b1+", b2="+b2+", b3="+b3+", x="+x);
if (nRawData < MAX_RAW_DATA) {
rawData[nRawData] = (int)Math.sqrt(x);
} else {

View File

@@ -492,6 +492,7 @@ public class StartupActivity extends Activity {
+ "\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 Added FOREGROUND_SERVICE permission, which seems to be necessary for Android V9."
+ "\n "
+ "\n PLEASE NOTE - THIS IS A BETA TEST VERSION SO MAY NOT WORK!"
+ "\n ."
@@ -528,6 +529,7 @@ public class StartupActivity extends Activity {
+ "\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 Added FOREGROUND_SERVICE permission, which seems to be necessary for Android V9."
+ "\n "
+ "\n PLEASE NOTE - THIS IS A BETA TEST VERSION SO MAY NOT WORK!"
+ "\n "