APPS Bluetooth Connection Fails

Hello everyone,

I'm working on a project with two apps (a Bluetooth Client and a Server) and despite following all the guides and exhaustively debugging the code, I can't establish a connection. I would greatly appreciate your help. I am new in this.

The Problem: The Controller app scans and displays the list of devices. However, upon selecting the Pet's device, the connection fails silently and is never established.

Summary of Debugging Steps Taken: We have verified and corrected the following, without success:

  1. Correct Architecture: The Emitter uses BluetoothClient and the Receiver uses BluetoothServer.
  2. Android 12+ Permissions: We correctly implemented permission requests for BLUETOOTH_SCAN, BLUETOOTH_CONNECT, and ACCESS_FINE_LOCATION using AskForPermission and the logic in the PermissionGranted event.
  3. Stable Connection: To avoid Error 507, the connection is initiated from a Clock timer, not directly in AfterPicking.
  4. Robust Connection (UUID): Both apps use ConnectWithUUID and AcceptConnectionWithUUID with the standard SPP UUID (00001101-...).
  5. Environment Diagnostics: We have restarted the phones, re-paired the devices, and disabled battery optimization.

I'm new to this. The AI and forums tells me this possible solution: "To work around this, we tried the two-list method, but the property block BluetoothClient.Addresses (which should return only the MACs) DOES NOT EXIST in my block palette. It is simply not available"

please help, thanks

  1. APP EMISORA: Pantalla principal (screen 1)

    code:

Pantalla de mando que envia las animaciones (screen 2)

CLOCK 1:

CLOCK 2:

blocks:

MY APPP: BottleFriend.aia (4.3 MB)

RECEIVER APP: (IN THIS ONE YOU WILL ONLY SEE THE ANIMATIONS, THEY ARE ALL LOOPING IMAGES.)
DESIGNER:


image
image

APP (link for size is 17mb): MIT App Inventor Gallery
I HOPE FOR YOUR HELP, IN A FEW DAYS I HAVE TO PRESENT THIS APP :C
pdt: I deleted images because it allows me only 7 multimedia

Try

Taifun

See

Switching screens breaks BT connections.

I removed the screen, leaving only the functional screen. Still does not connect the devices, the transmitter gives me the mac address, tries to connect and does not connect. Can you check both apps please? I would appreciate it very much.
EMISOR APP:
BottleFriend_checkpoint2.aia (4.3 MB)
RECEIVER APP:
https://gallery.appinventor.mit.edu/?galleryid=e1d49ffc-8928-44d2-a437-5dda95038dd1

Looking at the server app you posted to the Gallery, I do not see any attempts to send or receive any Bluetooth messages.


That can't be right.

You are missing the ReceiveText block here.

Looking at your client blocks,
you have open sockets, and you fail to connect after selecting a device.

I recommend rereading the btchat sample earlier in this thread.