diff --git a/app/src/main/java/io/legado/app/constant/AppConst.kt b/app/src/main/java/io/legado/app/constant/AppConst.kt index d3548c9f1..00d744fce 100644 --- a/app/src/main/java/io/legado/app/constant/AppConst.kt +++ b/app/src/main/java/io/legado/app/constant/AppConst.kt @@ -55,4 +55,8 @@ object AppConst { set(value) { App.INSTANCE.putPrefBoolean("bookGroupAudio", value) } + + const val notificationIdRead = 12 + const val notificationIdAudio = 13 + const val notificationIdWeb = 14 } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/service/AudioPlayService.kt b/app/src/main/java/io/legado/app/service/AudioPlayService.kt index 4b1e4912b..b4b56f4d5 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -343,7 +343,7 @@ class AudioPlayService : BaseService(), ) builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) val notification = builder.build() - startForeground(112201, notification) + startForeground(AppConst.notificationIdAudio, notification) } /** diff --git a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt index 431eaa8db..20d0887b8 100644 --- a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt @@ -320,7 +320,7 @@ abstract class BaseReadAloudService : BaseService(), ) builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) val notification = builder.build() - startForeground(112201, notification) + startForeground(AppConst.notificationIdRead, notification) } abstract fun aloudServicePendingIntent(actionStr: String): PendingIntent? diff --git a/app/src/main/java/io/legado/app/service/WebService.kt b/app/src/main/java/io/legado/app/service/WebService.kt index eec294aa1..a87fb520d 100644 --- a/app/src/main/java/io/legado/app/service/WebService.kt +++ b/app/src/main/java/io/legado/app/service/WebService.kt @@ -63,7 +63,6 @@ class WebService : BaseService() { ) builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) val notification = builder.build() - val notificationId = 1122 - startForeground(notificationId, notification) + startForeground(AppConst.notificationIdWeb, notification) } } \ No newline at end of file