From b065a20c4d1e524206d90d5227ebb0082f15f88d Mon Sep 17 00:00:00 2001 From: LaizyBoy Date: Thu, 7 May 2026 02:56:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(gpsrelaysentinel):=20=E5=89=8D=E5=8F=B0?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=80=9A=E7=9F=A5=E6=B7=BB=E5=8A=A0GPS?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=AE=A1=E6=95=B0=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加mGpsCount计数器统计GPS数据接收次数 - 每次onLocationChanged时计数器自增 - 通知栏实时显示GPS数据计数值(Count: x) - 计数包含在通知内容中:经纬度 | Count: x --- .../java/cc/winboll/studio/gpsrelaysentinel/MainService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gpsrelaysentinel/src/main/java/cc/winboll/studio/gpsrelaysentinel/MainService.java b/gpsrelaysentinel/src/main/java/cc/winboll/studio/gpsrelaysentinel/MainService.java index 8e3ec41..2b44c87 100644 --- a/gpsrelaysentinel/src/main/java/cc/winboll/studio/gpsrelaysentinel/MainService.java +++ b/gpsrelaysentinel/src/main/java/cc/winboll/studio/gpsrelaysentinel/MainService.java @@ -28,6 +28,7 @@ public class MainService extends Service { private static final int NOTIFICATION_ID = 1; private static final String PREF_NAME = "gps_relay_service_prefs"; private static final String KEY_SERVICE_ENABLED = "service_enabled"; + private int mGpsCount = 0; @Override public void onCreate() { @@ -67,6 +68,7 @@ public class MainService extends Service { mLocationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { + mGpsCount++; String gpsInfo = "Lat: " + location.getLatitude() + ", Lng: " + location.getLongitude(); LogUtils.d(TAG, "Location changed: " + gpsInfo); updateNotification(gpsInfo); @@ -129,7 +131,7 @@ public class MainService extends Service { private void updateNotification(String gpsInfo) { if (mNotificationBuilder != null) { - mNotificationBuilder.setContentText(gpsInfo); + mNotificationBuilder.setContentText(gpsInfo + " | Count: " + mGpsCount); mNotificationManager.notify(NOTIFICATION_ID, mNotificationBuilder.build()); } }