From 41fc4df45eb9c43560a9660188a614ede0072200 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期一, 29 十二月 2025 11:44:29 +0800
Subject: [PATCH] 2025年12月29日11:44:25
---
app/src/main/java/com/hdl/photovoltaic/uni/MyForegroundService.java | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 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 776ea30..523e730 100644
--- a/app/src/main/java/com/hdl/photovoltaic/uni/MyForegroundService.java
+++ b/app/src/main/java/com/hdl/photovoltaic/uni/MyForegroundService.java
@@ -12,8 +12,7 @@
import androidx.core.app.NotificationCompat;
import com.hdl.photovoltaic.R;
-import com.hdl.photovoltaic.other.HdlLogLogic;
-import com.hdl.photovoltaic.other.HdlThreadLogic;
+
public class MyForegroundService extends Service {
@@ -28,12 +27,21 @@
// 鍒涘缓閫氱煡娓犻亾锛圓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
@@ -41,8 +49,8 @@
// 鍒涘缓閫氱煡
Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle("")//瀹夸富杩涚▼鏈嶅姟
- .setContentText("")//姝e湪涓巙ni-app淇濇寔閫氫俊
- .setSmallIcon(R.drawable.notification_logo) // 蹇呴』璁剧疆涓�涓浘鏍�
+ .setContentText("")//姝e湪涓巙ni-app淇濇寔閫氫俊锛屼繚鎸佽繛鎺ヤ腑
+ .setSmallIcon(R.drawable.logo) // 蹇呴』璁剧疆涓�涓浘鏍�
.setPriority(NotificationCompat.PRIORITY_LOW)
// .setOngoing(true) // 璁剧疆閫氱煡涓烘寔缁�氱煡锛屼笉鍙竻闄�
// .setAutoCancel(false) // 鈫� 璁剧疆涓轰笉鍙嚜鍔ㄥ彇娑�
@@ -81,6 +89,7 @@
super.onDestroy();
isRunning = false;
}
+
public static boolean isServiceRunning() {
return isRunning;
}
--
Gitblit v1.8.0