mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix: CompanionDeviceManager.EXTRA_DEVICE return types
This commit is contained in:
parent
c9ecb2fe90
commit
ac63e72233
1 changed files with 6 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package com.geeksville.mesh.util
|
|||
|
||||
import android.app.PendingIntent
|
||||
import android.bluetooth.BluetoothDevice
|
||||
import android.bluetooth.le.ScanResult
|
||||
import android.companion.AssociationInfo
|
||||
import android.companion.CompanionDeviceManager
|
||||
import android.content.Intent
|
||||
|
|
@ -46,8 +47,11 @@ fun Intent.getAssociationResult(): String? = when {
|
|||
|
||||
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O ->
|
||||
@Suppress("DEPRECATION")
|
||||
getParcelableExtra<BluetoothDevice>(CompanionDeviceManager.EXTRA_DEVICE)
|
||||
?.address
|
||||
when (val it = getParcelableExtra<Parcelable>(CompanionDeviceManager.EXTRA_DEVICE)) {
|
||||
is BluetoothDevice -> it.address
|
||||
is ScanResult -> it.device.address
|
||||
else -> null
|
||||
}
|
||||
|
||||
else -> null
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue