# Companion

public class Companion

## Properties

DEFAULT_GENERAL_SCAN_PERIOD_MS
Link copied to clipboard
public final static Long DEFAULT_GENERAL_SCAN_PERIOD_MS

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

DEFAULT_SINGLE_DEVICE_PERIOD_MS
Link copied to clipboard
public final static Long DEFAULT_SINGLE_DEVICE_PERIOD_MS

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

INSTANCE
Link copied to clipboard
public final static IDeviceScanner.Companion INSTANCE
requiredBluetoothPermissions
Link copied to clipboard
private final Array<String> requiredBluetoothPermissions

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

getRequiredBluetoothPermissions
Link copied to clipboard
public final Array<String> getRequiredBluetoothPermissions()

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.

isBluetoothPermissionGranted
Link copied to clipboard
public final Boolean isBluetoothPermissionGranted(Context context)

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
public final Boolean requestBluetoothEnable(Context context)

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
@Deprecated(message = "This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `ActivityResultContract`. Use `registerForActivityResult(ActivityResultContract, ActivityResultCallback)` passing in a `RequestMultiplePermissions` object for the `ActivityResultContract` and handling the result in the callback. Use `IDeviceScanner.requiredBluetoothPermissions` as the required permissions.", replaceWith = @ReplaceWith(expression = "registerForActivityResult(ActivityResultContract, ActivityResultCallback)"))
public final Unit requestBluetoothPermissions(Activity activity, Integer requestCode)

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)
@Deprecated(message = "This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an `ActivityResultContract`. Use `registerForActivityResult(ActivityResultContract, ActivityResultCallback)` passing in a `RequestMultiplePermissions` object for the `ActivityResultContract` and handling the result in the callback. Use `IDeviceScanner.requiredBluetoothPermissions` as the required permissions.", replaceWith = @ReplaceWith(expression = "registerForActivityResult(ActivityResultContract, ActivityResultCallback)"))
public final Unit requestBluetoothPermissions(Fragment fragment, Integer requestCode)

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.