diff options
author | pacien | 2020-09-08 20:23:17 +0200 |
---|---|---|
committer | pacien | 2020-09-08 20:23:17 +0200 |
commit | ac79c601bd7fc379d7f857f3f0a716cce30e4b52 (patch) | |
tree | 3ecb3e62f5e98cac483eecbad1761c457c434f7f /app/src/main/java/org | |
parent | 31dcb2c5dd6a0546209f74dab49f5282f0a5bda4 (diff) | |
download | tincapp-ac79c601bd7fc379d7f857f3f0a716cce30e4b52.tar.gz |
service/conn change receiver: add note for new intent filter
Diffstat (limited to 'app/src/main/java/org')
-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) |