Error 507 Unable to connect

Hello everyone, I'm new here and I'm already stuck with a problem. I looked everywhere for a solution but couldn't find it.
I apologize for my English, but it's hard for me to write it, that's why I use a translator.
The error says: Error 507: Unable your conect....
It happens when I try to connect with my esp32
The code that is loaded is the following:

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
#include <BLE2902.h>
#include <NewPing.h>

// Configuración de pines del sensor HC-SR04
#define TRIGGER_PIN 2
#define ECHO_PIN 4

// Definición de la instancia del sensor
NewPing sonar(TRIGGER_PIN, ECHO_PIN);

// Definición de los UUID del servicio y la característica BLE
#define SERVICE_UUID        "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CONFIG_CHAR_UUID    "beb5483e-36e1-4688-b7f5-ea07361b26a8"

BLECharacteristic configCharacteristic(CONFIG_CHAR_UUID, BLECharacteristic::PROPERTY_WRITE);

void setup() {
  Serial.begin(115200);
  setupBLE();
}

void loop() {
  // Realizar la medición de distancia
  unsigned int distance = sonar.ping_cm();

  // Mostrar el resultado en el monitor serie
  Serial.print("Distancia: ");
  Serial.print(distance);
  Serial.println(" cm");

}

void setupBLE() {
  BLEDevice::init("ESP32 BL1");
  BLEServer *pServer = BLEDevice::createServer();

  BLEService *pService = pServer->createService(SERVICE_UUID);
  pService->addCharacteristic(&configCharacteristic);

  pService->start();

  // Asignar un descriptor a la característica para describir su función
  configCharacteristic.addDescriptor(new BLE2902());

  // Iniciar la publicidad BLE para permitir que los dispositivos cercanos lo encuentren
  BLEAdvertising *pAdvertising = pServer->getAdvertising();
  pAdvertising->start();
  Serial.println("Modo de configuración Bluetooth activado. Busque el dispositivo ESP32 BL1 en su aplicación móvil.");
}

And the screenshots of the app's structure in mit app I leave it in the photos.

I upload a video to youtube where I show how the error occurs.
Error 507
Does anyone know what it could be and why it happens?

I need to add that I found a video that talks about a possible solution explaining that the app does not have permissions to work with bluetooth but I did the test and the result is the same. I upload a screenshot of that modification for you to see.

thanks for any help

To connect to a BLE device, use the BLE extension instead of the BluetoothClassic component.

Thank you very much, I didn't know that I had to install an extension to work with BLE. Mark as solved and I will continue reading that documentation that you sent.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.