Fix onServiceDisconnected not called

This commit is contained in:
Mygod
2018-05-09 18:10:22 -07:00
parent dad9bc19e3
commit efa387fd7a
7 changed files with 19 additions and 23 deletions

View File

@@ -1,9 +1,6 @@
package be.mygod.vpnhotspot.util
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.*
import android.databinding.BindingAdapter
import android.support.annotation.DrawableRes
import android.util.Log
@@ -53,3 +50,8 @@ fun thread(name: String? = null, start: Boolean = true, isDaemon: Boolean = fals
if (start) thread.start()
return thread
}
fun Context.stopAndUnbind(connection: ServiceConnection) {
connection.onServiceDisconnected(null)
unbindService(connection)
}