kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
use same CompanionDeviceManager method
rodzic
3001696f9c
commit
45895cdcf6
|
@ -113,7 +113,9 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
|
||||||
@SuppressLint("NewApi", "MissingPermission")
|
@SuppressLint("NewApi", "MissingPermission")
|
||||||
override fun addressValid(context: Context, rest: String): Boolean {
|
override fun addressValid(context: Context, rest: String): Boolean {
|
||||||
val allPaired = if (hasCompanionDeviceApi(context)) {
|
val allPaired = if (hasCompanionDeviceApi(context)) {
|
||||||
val deviceManager = context.getSystemService(CompanionDeviceManager::class.java)
|
val deviceManager: CompanionDeviceManager by lazy {
|
||||||
|
context.getSystemService(Context.COMPANION_DEVICE_SERVICE) as CompanionDeviceManager
|
||||||
|
}
|
||||||
deviceManager.associations.map { it }.toSet()
|
deviceManager.associations.map { it }.toSet()
|
||||||
} else {
|
} else {
|
||||||
getBluetoothAdapter(context)?.bondedDevices.orEmpty()
|
getBluetoothAdapter(context)?.bondedDevices.orEmpty()
|
||||||
|
|
Ładowanie…
Reference in New Issue