package com.ic.work;
import android.app.Service;
+import android.content.ContentValues;
import android.content.Intent;
+import android.net.Uri;
import android.os.IBinder;
import android.os.PowerManager;
import android.os.RemoteCallbackList;
jxTempMode = -1;
}
sendTempBroadcast(wristTemp, bodyTemp, envTemp);
+ //写到设置项里,供各个地方获取
+ temperatureSave2Db(wristTemp, bodyTemp, envTemp);
+ }
+
+ public static final String PATH = "settings";
+ public static final String AUTHORITY = "com.ic.fzd.settings";
+ public static final String SETTINGS = "content://" + AUTHORITY + "/" + PATH;
+
+ private void temperatureSave2Db(double wristTemp, double bodyTemp, double envTemp) {
+ ContentValues bodyTempValue = new ContentValues();
+ bodyTempValue.put("s_key", "body_temperature");
+ bodyTempValue.put("s_value", bodyTemp);
+ getContentResolver().insert(
+ Uri.parse(SETTINGS),
+ bodyTempValue
+ );
+ ContentValues wristTempValue = new ContentValues();
+ wristTempValue.put("s_key", "wrist_temperature");
+ wristTempValue.put("s_value", wristTemp);
+ getContentResolver().insert(
+ Uri.parse(SETTINGS),
+ wristTempValue
+ );
+ ContentValues evnTempValue = new ContentValues();
+ evnTempValue.put("s_key", "env_temperature");
+ evnTempValue.put("s_value", envTemp);
+ getContentResolver().insert(
+ Uri.parse(SETTINGS),
+ evnTempValue
+ );
}
/**
IcLog.d(TAG, "on blood test end...");
//checkContinue();
// 心率有一个方去结束
+ //保存到数据库中
+ heartRateSave2Db(high, low, heart, oxygen);
+ }
+
+ /**
+ * 保存到数据库中,需要的地方监听即可,比如说Launcher
+ *
+ * @param high
+ * @param low
+ * @param heart
+ * @param oxygen
+ */
+ private void heartRateSave2Db(int high, int low, int heart, int oxygen) {
+ ContentValues highValues = new ContentValues();
+ highValues.put("s_key", "blood_high");
+ highValues.put("s_value", high);
+ getContentResolver().insert(Uri.parse(SETTINGS), highValues);
+
+ ContentValues lowValues = new ContentValues();
+ lowValues.put("s_key", "blood_low");
+ lowValues.put("s_value", low);
+ getContentResolver().insert(Uri.parse(SETTINGS), lowValues);
+
+ ContentValues heartRateValues = new ContentValues();
+ heartRateValues.put("s_key", "heart_rate");
+ heartRateValues.put("s_value", heart);
+ getContentResolver().insert(Uri.parse(SETTINGS), heartRateValues);
+
+ ContentValues oxygenValues = new ContentValues();
+ oxygenValues.put("s_key", "oxygen");
+ oxygenValues.put("s_value", oxygen);
+ getContentResolver().insert(Uri.parse(SETTINGS), oxygenValues);
}
@Override