Restart service on network capabilities changed

This commit is contained in:
sim 2022-01-17 20:58:47 +01:00
parent 31cf3fb21a
commit 52a956464a
1 changed files with 6 additions and 2 deletions

View File

@ -121,8 +121,12 @@ class StartService: Service(){
startListener(this@StartService) startListener(this@StartService)
} }
override fun onLost(network: Network) { override fun onCapabilitiesChanged(
Log.d(TAG, "Network is DISCONNECTED") network: Network,
networkCapabilities: NetworkCapabilities
) {
Log.d(TAG, "Network Capabilities changed")
startListener(this@StartService)
} }
}) })
} catch (e: Exception) { } catch (e: Exception) {