aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorpacien2018-09-27 17:28:54 +0200
committerpacien2018-09-27 17:28:54 +0200
commit31c49c198e2ddc56565b04675fc167df237de0d3 (patch)
treef71259ea35707ed78c01799eace08b83ce9208fb /app/src/main/java
parentec3bc745918b588072b5104e571a929e17df5732 (diff)
downloadtincapp-31c49c198e2ddc56565b04675fc167df237de0d3.tar.gz
Handle unregistered receiver de-registration
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/org/pacien/tincapp/service/ConnectivityChangeReceiver.kt7
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
25import android.net.ConnectivityManager 25import android.net.ConnectivityManager
26import org.pacien.tincapp.commands.Tinc 26import org.pacien.tincapp.commands.Tinc
27import org.slf4j.LoggerFactory 27import org.slf4j.LoggerFactory
28import 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}