From 8b4624982cc1d7d7dafec08b954c5f54c58847d9 Mon Sep 17 00:00:00 2001 From: MiMo Date: Mon, 6 Jul 2026 13:58:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20GPS=E5=AE=9A=E4=BD=8D=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=90=E8=A1=8C=E7=8A=B6=E6=80=81=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - GpsReceiveService 新增公共静态函数 isServiceRunning() - SettingsActivity 窗口初始化时查询服务状态并同步开关状态 --- bytheway/build.properties | 4 ++-- .../studio/bytheway/activities/SettingsActivity.java | 1 + .../studio/bytheway/services/GpsReceiveService.java | 8 ++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bytheway/build.properties b/bytheway/build.properties index 01a9415..62b154d 100644 --- a/bytheway/build.properties +++ b/bytheway/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Fri Jul 03 13:02:58 HKT 2026 +#Mon Jul 06 13:56:29 CST 2026 stageCount=2 libraryProject= baseVersion=15.20 publishVersion=15.20.1 -buildCount=0 +buildCount=9 baseBetaVersion=15.20.2 diff --git a/bytheway/src/main/java/cc/winboll/studio/bytheway/activities/SettingsActivity.java b/bytheway/src/main/java/cc/winboll/studio/bytheway/activities/SettingsActivity.java index fae9242..20a6110 100644 --- a/bytheway/src/main/java/cc/winboll/studio/bytheway/activities/SettingsActivity.java +++ b/bytheway/src/main/java/cc/winboll/studio/bytheway/activities/SettingsActivity.java @@ -17,6 +17,7 @@ public class SettingsActivity extends Activity { setContentView(R.layout.activity_settings); Switch swGpsService = findViewById(R.id.sw_gps_service); + swGpsService.setChecked(GpsReceiveService.isServiceRunning()); swGpsService.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { diff --git a/bytheway/src/main/java/cc/winboll/studio/bytheway/services/GpsReceiveService.java b/bytheway/src/main/java/cc/winboll/studio/bytheway/services/GpsReceiveService.java index 5699fc2..721160b 100644 --- a/bytheway/src/main/java/cc/winboll/studio/bytheway/services/GpsReceiveService.java +++ b/bytheway/src/main/java/cc/winboll/studio/bytheway/services/GpsReceiveService.java @@ -30,6 +30,14 @@ public class GpsReceiveService extends Service { private GpsDbManager dbManager; private BroadcastReceiver gpsBroadcastReceiver; + /** + * 获取GPS定位服务运行状态 + * @return true=服务正在运行, false=服务未运行 + */ + public static boolean isServiceRunning() { + return serviceRunning; + } + /** * 外部统一静态启动服务 */