Forces reconnection when a new service is available.
This commit is contained in:
@@ -159,6 +159,14 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
private val networkCallback = object : ConnectivityManager.NetworkCallback() {
|
||||
override fun onAvailable(network: Network) {
|
||||
super.onAvailable(network)
|
||||
|
||||
GlobalScope.launch(Dispatchers.IO) {
|
||||
ServiceManager.forceRestartIfItShould()
|
||||
}
|
||||
}
|
||||
|
||||
// Network capabilities have changed for the network
|
||||
override fun onCapabilitiesChanged(
|
||||
network: Network,
|
||||
|
||||
Reference in New Issue
Block a user