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 60ce40004..b32e6d6bc 100644 --- a/app/src/main/java/io/legado/app/service/WebService.kt +++ b/app/src/main/java/io/legado/app/service/WebService.kt @@ -48,6 +48,12 @@ class WebService : BaseService() { override fun onDestroy() { super.onDestroy() isRun = false + if (httpServer?.isAlive == true) { + httpServer?.stop() + } + if (webSocketServer?.isAlive == true) { + webSocketServer?.stop() + } } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { @@ -112,4 +118,4 @@ class WebService : BaseService() { val notification = builder.build() startForeground(AppConst.notificationIdWeb, notification) } -} \ No newline at end of file +}