Companion

public class Companion

Properties

Link copied to clipboard

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

Link copied to clipboard

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

Link copied to clipboard
public final static IDeviceScanner.Companion INSTANCE
Link copied to clipboard

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

Link copied to clipboard

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

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

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

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(imports = {}, 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(imports = {}, 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.