Black Screen while trying to connect?

Hello everyone, so I have this issue and i am not sure if its a bug or if i am doing something wrong.. (i am probably doing something wrong)
So basically, I am really new to MIT App Inventor and everything and I have been experimenting with MIT App Inventor to make my Project.
My Project for now consists of a linear motor that has to either go up, down or stand still. I want to control the movement by a self made App, bluetooth and an ESP32.

This is the MIT App and Code i made so far:



Basically, what i would like my app to do is: 1) Pick a bluetooth device (the ESP) and show all bluetooth devices in my surroundings in the list. And then, with the buttons, i would like to control the movement (either up or down)

The issue is, whenever i try to connect a bluetooth device by app (by clicking on the list), my screen just turns black! And I cant even get out of this. The only way to then try again to connect my Tablet to something is by closing the App completely and the restarting it..

As i mentioned, I am really new to all of this, so I apprechiate every help that I get!
Thank you so much in advance :slight_smile:

You forgot to ask for permission...
Taifun


(Canned Response ABG - Bluetooth non-BLE SCAN Permission Blocks)

The easiest solution, for immediate relief
(from @Barry_Meaker) ...

I had the same issue. The problem is your app does not have permission to see nearby devices. The solution is to give your app permission on your phone (no code changes in your app).

on your phone,

  • goto settings
  • search for your app
  • in App Info for your app select Permissions
  • change Nearby Devices from Not Allowed to Allowed
  • Done

By the way, the very first time you run the app, Android will ask if you want to grant the app this permission. If you say no, or ignore the pop-up, the permission will be set as Denied. Android will not ask again.

A more complex approach, for professional app development:

See Bluetooth liste of devices deosn't work anymore - #7 by Anke
Special note for Xiaomi devices:
I have an error with bluetooth on android 12, Xiaomi Poco X3 NFC - #20 by Patryk_F

So, what is on your ESP32?
And, in your app you seem to want to use classic BT, but is that also what the ESP32 wants? I understand it can also use BLE.

thank you soosossoos much <3

hi , I also have the same issue. I tried this solution but still got black blank page. Here is my MIT code , can you review it ?

Yes, you have the same issue, because also you do not ask for permissions

Taifun


this one right ? I still can't connect it

Try the second test project from here

Taifun

Yes this is it and it worked for me. The only thing that i can think of rn is that you have to connect the ESP beforehand with bluetooth and then you can choose it on the app -> shortly, the bluetooth device you want to be connected with has to be coupled with you phone or whereever you downloaded app is on. :slight_smile:
i am also really new to this so this is the only thing i can think of, i hope it helps

I try Android 11 phone is ok,but in Android 7.0 is nothing.
Mybe you can change other phone.

What exactly are you talking about?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.