Skip to content

Commit

Permalink
Merge pull request #2 from muhammadisa/version-1.0.1
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
muhammadisa committed Aug 2, 2020
2 parents 52b2876 + 83b7dd0 commit d46a29f
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.content.Intent
import android.content.IntentFilter
import android.net.*
import android.os.Build
import android.util.Log
import androidx.lifecycle.LiveData

/*
Expand Down Expand Up @@ -49,10 +50,14 @@ class Lifemark constructor(private val context: Context) {

override fun onInactive() {
super.onInactive()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
connectivityManager.unregisterNetworkCallback(connectivityManagerCallback())
else
context.unregisterReceiver(networkReceiver)
try{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
connectivityManager.unregisterNetworkCallback(connectivityManagerCallback())
else
context.unregisterReceiver(networkReceiver)
}catch (e: Exception) {
Log.e("Lifemark", "NetworkCallback already unregistered")
}
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
Expand Down

0 comments on commit d46a29f

Please sign in to comment.