diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt | 7 |
1 files changed, 6 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 ba9aa95..a72a1aa 100644 --- a/app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt +++ b/app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt | |||
@@ -25,6 +25,7 @@ import android.content.IntentFilter | |||
25 | import android.net.ConnectivityManager | 25 | import android.net.ConnectivityManager |
26 | import org.pacien.tincapp.commands.Tinc | 26 | import org.pacien.tincapp.commands.Tinc |
27 | import org.slf4j.LoggerFactory | 27 | import org.slf4j.LoggerFactory |
28 | import java.lang.IllegalArgumentException | ||
28 | 29 | ||
29 | /** | 30 | /** |
30 | * @author pacien | 31 | * @author pacien |
@@ -55,6 +56,10 @@ object ConnectivityChangeReceiver : BroadcastReceiver() { | |||
55 | } | 56 | } |
56 | 57 | ||
57 | fun unregisterWatcher(context: Context) { | 58 | fun unregisterWatcher(context: Context) { |
58 | context.unregisterReceiver(this) | 59 | try { |
60 | context.unregisterReceiver(this) | ||
61 | } catch (e: IllegalArgumentException) { | ||
62 | // already unregistered | ||
63 | } | ||
59 | } | 64 | } |
60 | } | 65 | } |