diff options
Diffstat (limited to 'app/src/main/java/org/pacien')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt b/app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt index a72a1aa..a25e673 100644 --- a/app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt +++ b/app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon | 2 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon |
3 | * Copyright (C) 2017-2018 Pacien TRAN-GIRARD | 3 | * Copyright (C) 2017-2020 Pacien TRAN-GIRARD |
4 | * | 4 | * |
5 | * This program is free software: you can redistribute it and/or modify | 5 | * This program is free software: you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -50,6 +50,14 @@ object ConnectivityChangeReceiver : BroadcastReceiver() { | |||
50 | private fun isNetworkAvailable(intent: Intent) = | 50 | private fun isNetworkAvailable(intent: Intent) = |
51 | !intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false) | 51 | !intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false) |
52 | 52 | ||
53 | // TODO: ConnectivityManager.CONNECTIVITY_ACTION was deprecated in API level 28. | ||
54 | // "Apps should use the more versatile | ||
55 | // requestNetwork(NetworkRequest, PendingIntent), | ||
56 | // registerNetworkCallback(NetworkRequest, PendingIntent) or | ||
57 | // registerDefaultNetworkCallback(ConnectivityManager.NetworkCallback) | ||
58 | // functions instead for faster and more detailed updates | ||
59 | // about the network changes they care about." | ||
60 | // See https://developer.android.com/reference/android/net/ConnectivityManager | ||
53 | fun registerWatcher(context: Context) { | 61 | fun registerWatcher(context: Context) { |
54 | val filter = IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION) | 62 | val filter = IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION) |
55 | context.registerReceiver(this, filter) | 63 | context.registerReceiver(this, filter) |