Fix NoClassDefFoundError for RangingManager on Android < API 36

This commit is contained in:
himalia416
2025-10-08 17:01:14 +02:00
committed by Himali Aryal
parent a3c5d5fb60
commit 8fb861884e

View File

@@ -30,11 +30,12 @@ import no.nordicsemi.android.toolbox.profile.repository.channelSounding.ChannelS
import no.nordicsemi.kotlin.ble.client.android.Peripheral
import timber.log.Timber
import javax.inject.Inject
import javax.inject.Provider
@HiltViewModel
internal class ProfileViewModel @Inject constructor(
private val profileServiceManager: ProfileServiceManager,
private val channelSoundingManager: ChannelSoundingManager,
private val channelSoundingManager: Provider<ChannelSoundingManager>,
private val navigator: Navigator,
private val deviceRepository: DeviceRepository,
private val analytics: AppAnalytics,
@@ -131,7 +132,7 @@ internal class ProfileViewModel @Inject constructor(
if (state.deviceData.services.any { it.profile == Profile.CHANNEL_SOUNDING }) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.BAKLAVA) {
try {
channelSoundingManager.closeSession()
channelSoundingManager.get().closeSession()
} catch (e: Exception) {
Timber.e(" ${e.message}")
}