From ac79c601bd7fc379d7f857f3f0a716cce30e4b52 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 8 Sep 2020 20:23:17 +0200 Subject: service/conn change receiver: add note for new intent filter --- .../org/pacien/tincapp/service/ConnectivityChangeReceiver.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'app/src/main/java') 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 @@ /* * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon - * Copyright (C) 2017-2018 Pacien TRAN-GIRARD + * Copyright (C) 2017-2020 Pacien TRAN-GIRARD * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,6 +50,14 @@ object ConnectivityChangeReceiver : BroadcastReceiver() { private fun isNetworkAvailable(intent: Intent) = !intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false) + // TODO: ConnectivityManager.CONNECTIVITY_ACTION was deprecated in API level 28. + // "Apps should use the more versatile + // requestNetwork(NetworkRequest, PendingIntent), + // registerNetworkCallback(NetworkRequest, PendingIntent) or + // registerDefaultNetworkCallback(ConnectivityManager.NetworkCallback) + // functions instead for faster and more detailed updates + // about the network changes they care about." + // See https://developer.android.com/reference/android/net/ConnectivityManager fun registerWatcher(context: Context) { val filter = IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION) context.registerReceiver(this, filter) -- cgit v1.2.3