save weather to fzd db.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 25 May 2021 09:09:41 +0000 (17:09 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 25 May 2021 09:09:41 +0000 (17:09 +0800)
app/src/main/java/com/ic/protocols/protocol_fzd.java

index fd19657..ca9170f 100644 (file)
@@ -2388,6 +2388,30 @@ public class protocol_fzd {
                         null, wtCode, currentTemp, lowTemp,
                         highTemp, cityName, null, null, date + " " + time
                 );
+                //key值可以去看交互文档
+                //weather_type,weather_temp
+                //天气类型就是wtCode
+                //天气温度就是当前温度currentTemp
+                //数据库为settings,k-v的形式存储
+                //保存当前温度
+                //当前天气码保存到数据库中
+                //让监听的地方去更新即可
+                //插入天气类型
+                ContentValues wtCodeValues = new ContentValues();
+                wtCodeValues.put(FZDDatabaseHelper.sKey, "weather_type");
+                wtCodeValues.put(FZDDatabaseHelper.sValue, wtCode);
+                mRuntime.getContextProxy().getResolver().insert(
+                        Uri.parse(FZDSettingsProvider.SETTINGS),
+                        wtCodeValues
+                );
+                //插入天气当前温度
+                ContentValues tempValues = new ContentValues();
+                tempValues.put(FZDDatabaseHelper.sKey, "weather_temp");
+                tempValues.put(FZDDatabaseHelper.sValue, currentTemp);
+                mRuntime.getContextProxy().getResolver().insert(
+                        Uri.parse(FZDSettingsProvider.SETTINGS),
+                        tempValues
+                );
                 if (mRuntime.mFZDWeatherCallback != null) {
                     mRuntime.mFZDWeatherCallback.onWeatherInfoLoaded(fzdWeatherInfo);
                 }