File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
service/src/main/java/com/github/kr328/clash/service/clash/module Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import android.app.Service
55import android.content.Intent
66import android.os.PowerManager
77import androidx.core.app.NotificationCompat
8+ import androidx.core.app.NotificationManagerCompat
89import androidx.core.content.getSystemService
910import com.github.kr328.clash.common.compat.getColorCompat
1011import com.github.kr328.clash.common.compat.pendingIntentFlags
@@ -40,6 +41,8 @@ class DynamicNotificationModule(service: Service) : Module<Unit>(service) {
4041 )
4142 )
4243
44+ private val notificationManager = NotificationManagerCompat .from(service)
45+
4346 private fun update () {
4447 val now = Clash .queryTrafficNow()
4548 val total = Clash .queryTrafficTotal()
@@ -64,7 +67,7 @@ class DynamicNotificationModule(service: Service) : Module<Unit>(service) {
6467 )
6568 .build()
6669
67- service.startForeground (R .id.nf_clash_status, notification)
70+ notificationManager.notify (R .id.nf_clash_status, notification)
6871 }
6972
7073 override suspend fun run () = coroutineScope {
You can’t perform that action at this time.
0 commit comments