# Companion

object Companion

## Properties

DEFAULT_GENERAL_SCAN_PERIOD_MS
Link copied to clipboard
const val DEFAULT_GENERAL_SCAN_PERIOD_MS: Long = 20000

Scan period in milliseconds used when no time period is provided to start.

DEFAULT_SINGLE_DEVICE_PERIOD_MS
Link copied to clipboard
const val DEFAULT_SINGLE_DEVICE_PERIOD_MS: Long = 10000

Scan period in milliseconds used when no time period is provided to start or scanForHardwareId.

requiredBluetoothPermissions
Link copied to clipboard
val requiredBluetoothPermissions: Array<String>

List of specific permissions required for discovering and connecting to Nix devices via Bluetooth which can vary depending on Android version. This list provides the correct permissions for the version of Android seen at runtime.

## Functions

isBluetoothPermissionGranted
Link copied to clipboard
fun isBluetoothPermissionGranted(context: Context?): Boolean

Checks if the permissions necessary for accessing Bluetooth devices have been granted by the user. If `false`, these permissions can be requested using requestBluetoothPermissions.

requestBluetoothEnable
Link copied to clipboard
fun requestBluetoothEnable(context: Context?): Boolean

Launches a new intent to request the user to enable Bluetooth. This requires that the necessary Bluetooth permissions have been granted.

requestBluetoothPermissions
Link copied to clipboard
fun requestBluetoothPermissions(activity: Activity?, requestCode: Int)

Wrapper around ActivityCompat.requestPermissions to request permissions from the user required for running a search for Bluetooth devices. Results of the request will be provided to your ActivityCompat.OnRequestPermissionsResultCallback.onRequestPermissionsResult callback in your activity. Before making the request, you can use isBluetoothPermissionGranted to check if these permissions have already been granted.

@RequiresApi(value = 23)
fun requestBluetoothPermissions(fragment: Fragment?, requestCode: Int)

Wrapper around Fragment.requestPermissions to request permissions from the user required for running a search for Bluetooth devices. Results of the request will be provided to your Fragment.onRequestPermissionsResult callback in your fragment. Before making the request, you can use isBluetoothPermissionGranted to check if these permissions have already been granted.