From d22974af03fb5a008cf1187e7b96cb37ea0b3093 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期一, 22 十二月 2025 10:09:30 +0800
Subject: [PATCH] 2025-12-22 10:09:27
---
app/src/main/java/com/hdl/photovoltaic/uni/MyForegroundService.java | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/uni/MyForegroundService.java b/app/src/main/java/com/hdl/photovoltaic/uni/MyForegroundService.java
index da8b9fb..e010d83 100644
--- a/app/src/main/java/com/hdl/photovoltaic/uni/MyForegroundService.java
+++ b/app/src/main/java/com/hdl/photovoltaic/uni/MyForegroundService.java
@@ -14,6 +14,7 @@
import com.hdl.photovoltaic.R;
+
public class MyForegroundService extends Service {
private static final String CHANNEL_ID = "MyForegroundServiceChannel";
private static final int NOTIFICATION_ID = 1;
@@ -26,8 +27,23 @@
// 鍒涘缓閫氱煡娓犻亾锛圓ndroid 8.0+锛�
createNotificationChannel();
isRunning = true;
- }
+ }
+// @Override
+// public void onTaskRemoved(Intent rootIntent) {
+// super.onTaskRemoved(rootIntent);
+// isRunning = false;
+
+ /// / // 鍋滄鍓嶅彴鐘舵�侊紝绉婚櫎閫氱煡
+ /// / stopForeground(true); // true琛ㄧず绉婚櫎閫氱煡
+ /// /// // 鍋滄鏈嶅姟
+ /// /// stopSelf();
+// // 1. 鍏堢Щ闄ゅ墠鍙扮姸鎬侊紙鍙�夛紝浣嗗缓璁級
+// stopForeground(true);
+//
+// // 2. 鍋滄鏈嶅姟
+// stopSelf();
+// }
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// 鍒涘缓閫氱煡
@@ -73,6 +89,7 @@
super.onDestroy();
isRunning = false;
}
+
public static boolean isServiceRunning() {
return isRunning;
}
--
Gitblit v1.8.0