Catch BLUETOOTH permission missing exception

This commit is contained in:
Mygod
2018-09-17 22:08:31 +08:00
parent d21193ba17
commit f27fdb5ce7

View File

@@ -168,7 +168,13 @@ sealed class TetherManager(protected val parent: TetheringFragment) : Manager(),
init {
parent.lifecycle.addObserver(this)
try {
BluetoothAdapter.getDefaultAdapter()?.getProfileProxy(parent.requireContext(), this, PAN)
} catch (e: SecurityException) {
e.printStackTrace()
Crashlytics.logException(e)
SmartSnackbar.make(e.localizedMessage).show()
}
}
override fun onServiceDisconnected(profile: Int) {