PreviewEnvironment

class PreviewEnvironment(val androidSdkVersion: Int = AndroidEnvironment.SdkVersion.LATEST, val deviceName: String = "Stub", bluetoothState: Manager.State = Manager.State.POWERED_ON, val locationState: StateFlow<Boolean> = MutableStateFlow(true), val isBluetoothSupported: Boolean = true, val isLocationRequiredForScanning: Boolean = false, val isLocationPermissionGranted: Boolean = false, val isLe2MPhySupported: Boolean = true, val isLeCodedPhySupported: Boolean = true, val isScanningOnLeCodedPhySupported: Boolean = true, val isBluetoothScanPermissionGranted: Boolean = true, val isBluetoothConnectPermissionGranted: Boolean = true, val isBluetoothAdvertisePermissionGranted: Boolean = true, val isBluetoothPrivilegedPermissionGranted: Boolean = false, val isMultipleAdvertisementSupported: Boolean = true, val isLeExtendedAdvertisingSupported: Boolean = true, val isLePeriodicAdvertisingSupported: Boolean = true, val leMaximumAdvertisingDataLength: Int = 1650) : AndroidEnvironment

A stub implementation of AndroidEnvironment for Android.

This can be used for showing @Preview in the Compose UI.

Constructors

Link copied to clipboard
constructor(androidSdkVersion: Int = AndroidEnvironment.SdkVersion.LATEST, deviceName: String = "Stub", bluetoothState: Manager.State = Manager.State.POWERED_ON, locationState: StateFlow<Boolean> = MutableStateFlow(true), isBluetoothSupported: Boolean = true, isLocationRequiredForScanning: Boolean = false, isLocationPermissionGranted: Boolean = false, isLe2MPhySupported: Boolean = true, isLeCodedPhySupported: Boolean = true, isScanningOnLeCodedPhySupported: Boolean = true, isBluetoothScanPermissionGranted: Boolean = true, isBluetoothConnectPermissionGranted: Boolean = true, isBluetoothAdvertisePermissionGranted: Boolean = true, isBluetoothPrivilegedPermissionGranted: Boolean = false, isMultipleAdvertisementSupported: Boolean = true, isLeExtendedAdvertisingSupported: Boolean = true, isLePeriodicAdvertisingSupported: Boolean = true, leMaximumAdvertisingDataLength: Int = 1650)

Properties

Link copied to clipboard
open override val allowsBondRemoval: Boolean
Link copied to clipboard
open override val androidSdkVersion: Int

The Android SDK version.

Link copied to clipboard
Link copied to clipboard
open override val bluetoothState: StateFlow<Manager.State>

A flow emitting the current Bluetooth state.

Link copied to clipboard
open override val deviceName: String
Link copied to clipboard

The local Bluetooth adapter name, or null if the required permission is not granted.

Link copied to clipboard

Whether the BLUETOOTH_ADVERTISE permission is granted.

Link copied to clipboard

Whether the BLUETOOTH_CONNECT permission is granted.

Link copied to clipboard
open override val isBluetoothEnabled: Boolean
Link copied to clipboard

Whether BLUETOOTH_PRIVILEGED permission is granted. This permission cannot be granted to 3-rd party apps.

Link copied to clipboard

Whether the BLUETOOTH_SCAN permission is granted.

Link copied to clipboard
open override val isBluetoothSupported: Boolean
Link copied to clipboard
open override val isLe2MPhySupported: Boolean

Whether LE 2M PHY is supported on the device.

Link copied to clipboard
open override val isLeCodedPhySupported: Boolean

Whether LE Coded PHY is supported on the device.

Link copied to clipboard

Whether LE Extended Advertising feature is supported.

Link copied to clipboard

Whether LE Periodic Advertising feature is supported.

Link copied to clipboard

Whether location service is enabled on the device.

Link copied to clipboard

Whether the ACCESS_FINE_LOCATION permission is granted.

Link copied to clipboard

Whether location is required to scan for Bluetooth LE devices.

Link copied to clipboard

Whether multi advertisement is supported by the chipset.

Link copied to clipboard
Link copied to clipboard
open override val isSystem: Boolean
Link copied to clipboard

The maximum LE advertising data length in bytes, if LE Extended Advertising feature is supported.

Link copied to clipboard
open override val locationState: StateFlow<Boolean>

A flow emitting the state of the location service, true when enabled, false otherwise. Location service is required to scan for Bluetooth LE beacons when isLocationRequiredForScanning is true.

Link copied to clipboard
open override val reportsConnectableFlag: Boolean
Link copied to clipboard
Link copied to clipboard

Whether the device requires runtime permissions to use Bluetooth.

Link copied to clipboard

Whether the device supports runtime permissions.

Functions

Link copied to clipboard
open override fun close()

Unregisters the broadcast receiver that listens for Bluetooth state changes.

Link copied to clipboard
open override fun enableBluetooth()

Sends an intent to enable Bluetooth adapter on the device.