# requestBluetoothPermissions

fun requestBluetoothPermissions(activity: Activity?, requestCode: Int)

### Deprecated

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.

#### Replace with

    registerForActivityResult(ActivityResultContract, ActivityResultCallback)

Content copied to clipboard

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.

#### Parameters

activity

Activity making the request.

requestCode

Integer request code (starting from 0) to identify this request.

#### See also

ActivityCompat.requestPermissions

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

### Deprecated

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.

#### Replace with

    registerForActivityResult(ActivityResultContract, ActivityResultCallback)

Content copied to clipboard

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.