Fix android service restart
This commit is contained in:
@@ -114,7 +114,7 @@ class MethodHandler(private val scope: CoroutineScope) : FlutterPlugin,
|
||||
if (restart) {
|
||||
mainActivity.reconnect()
|
||||
BoxService.stop()
|
||||
delay(200L)
|
||||
delay(1000L)
|
||||
mainActivity.startService()
|
||||
return@launch success(true)
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class BoxService(
|
||||
}
|
||||
|
||||
if (delayStart) {
|
||||
delay(200L)
|
||||
delay(1000L)
|
||||
}
|
||||
|
||||
newService.start()
|
||||
@@ -195,7 +195,7 @@ class BoxService(
|
||||
|
||||
override fun serviceReload() {
|
||||
status.postValue(Status.Starting)
|
||||
GlobalScope.launch(Dispatchers.IO) {
|
||||
runBlocking {
|
||||
val pfd = fileDescriptor
|
||||
if (pfd != null) {
|
||||
pfd.close()
|
||||
|
||||
Reference in New Issue
Block a user