Properly handle missing bluetooth permissions

This commit is contained in:
Mygod
2021-06-11 02:15:49 +08:00
parent 6f81f8a6ff
commit 440b22faa1
3 changed files with 21 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
package be.mygod.vpnhotspot.manage
import android.annotation.SuppressLint
import android.annotation.TargetApi
import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothManager
@@ -123,6 +124,7 @@ class BluetoothTethering(context: Context, val stateListener: () -> Unit) :
/**
* https://android.googlesource.com/platform/packages/apps/Settings/+/b1af85d/src/com/android/settings/TetherSettings.java#384
*/
@SuppressLint("MissingPermission")
@RequiresApi(24)
fun start(callback: TetheringManager.StartTetheringCallback) {
if (pendingCallback == null) try {