setProfileConnectionPolicy

abstract suspend fun setProfileConnectionPolicy(    deviceAddress: BluetoothDeviceAddress,     profile: BluetoothDeviceProfile,     isAllowed: Boolean): Boolean

Sets the platform side connection policy for a specific Bluetooth device, which is registered to BluetoothDeviceAddress. The connection policy of the remote device is not impacted and will not change.

Note: When the provided profile is not in connectableProfiles, this function will fail and return false.

Return

true when setting the policy was successful, false otherwise.

Parameters

deviceAddress

The address of the device.

profile

The Bluetooth profile for which the policy needs to be set.

isAllowed

When true, the connection will be allowed for the profile, otherwise the connection will be rejected.