'How to detect if user denied ask for switch on bluetooth

How to detect when user didn't allow for open bluetooth?

   if(!isBluetoothOpen()) {
        val enableBluetoothIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
        if (isPermissionGranted()) {
            startActivityForResult(
                enableBluetoothIntent,
                REQUEST_ENABLE_BLUETOOTH
            )
        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source