Skip to content

Commit

Permalink
Replace deprecated bluetooth calls
Browse files Browse the repository at this point in the history
  • Loading branch information
NotWoods committed Jan 17, 2022
1 parent 0b3f337 commit 6c07f87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothManager
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.BitmapFactory
Expand Down Expand Up @@ -72,7 +70,6 @@ import java.net.URL
import java.net.URLDecoder
import java.util.Locale
import javax.inject.Inject
import kotlin.collections.HashMap
import io.homeassistant.companion.android.common.R as commonR

@AndroidEntryPoint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package io.homeassistant.companion.android.bluetooth.ble

import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothManager
import android.bluetooth.le.AdvertiseCallback
import android.bluetooth.le.AdvertiseSettings
import android.content.Context
import androidx.core.content.getSystemService
import org.altbeacon.beacon.Beacon
import org.altbeacon.beacon.BeaconParser
import org.altbeacon.beacon.BeaconTransmitter
Expand Down Expand Up @@ -53,7 +55,8 @@ object TransmitterManager {
val parser = BeaconParser().setBeaconLayout(haTransmitter.beaconLayout)
physicalTransmitter = BeaconTransmitter(context, parser)
}
val bluetoothOn = BluetoothAdapter.getDefaultAdapter().isEnabled
val bluetoothAdapter = context.getSystemService<BluetoothManager>()?.adapter
val bluetoothOn = bluetoothAdapter?.isEnabled == true
if (bluetoothOn) {
val beacon = buildBeacon(haTransmitter)
if (!physicalTransmitter.isStarted) {
Expand Down

0 comments on commit 6c07f87

Please sign in to comment.