# BLE scan function not working

**URL:** <https://community.thunkable.com/t/ble-scan-function-not-working/708420>\
**Category:** Questions about Thunkable X\
**Tags:** beginner, bluetooth\
**Created:** [July 29, 2020, 6:43am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420 "2020-07-29T06:43:58Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![rariac](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@rariac](https://community.thunkable.com/u/rariac)\
**Post date:** [July 29, 2020, 6:43am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/1 "2020-07-29T06:43:59Z")

</div>

Hi,

I have been working on an app for a school project and I need to connect my app to an Arduino board via Bluetooth. However, the BLE scan function returns “undefined” as an output no matter what I do. I am using Thunkable Live on an Android phone. I have also allowed all permissions and switched on Bluetooth on my phone, but it is still not working. My code is below.

 ![Screenshot 2020-07-29 at 2.40.22 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/e/9ec1e171c0069d2dac6171819dbb8fea95e6124d.png)  
I hope you can give me some tips on what I have done wrong or what I should do to solve this problem. Thanks!

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [July 29, 2020, 9:57am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/2 "2020-07-29T09:57:42Z")

</div>

@rariac, can you add a location sensor to your project and try again please?

Thanks

---

<div class="post-metadata">

**Author:** ![eddie.rebehy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eddie.rebehy/32/67993_2.png) [@eddie.rebehy](https://community.thunkable.com/u/eddie.rebehy)\
**Post date:** [July 29, 2020, 10:42am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/3 "2020-07-29T10:42:42Z")

</div>

hi @rariac,

try adding a list viewer and settimg text items of list viewer rather than a single label. looks like you are trying to set text of a label to a list of mac addresses and I’m not sure you can do it that way.

---

<div class="post-metadata">

**Author:** ![rariac](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@rariac](https://community.thunkable.com/u/rariac)\
**Post date:** [July 30, 2020, 8:53am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/4 "2020-07-30T08:53:49Z")

</div>

My project actually does have a location sensor in it. I’m sorry I didn’t mention it because I thought they were unrelated haha. What should I do now?

---

<div class="post-metadata">

**Author:** ![rariac](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@rariac](https://community.thunkable.com/u/rariac)\
**Post date:** [July 30, 2020, 9:07am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/5 "2020-07-30T09:07:08Z")

</div>

Hi! So I tried using a list viewer instead of a label and now there is not output at all not even the “undefined”. Also, just in case something else is interfering with it, the code for my entire page is below.

 ![Screenshot 2020-07-30 at 5.01.45 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/1/f1e3afb3292e2e971b387a86d5e75d7637a8734f.png)  
I actually got this code from another thunkable community post which I can’t find right now but if you need to see it I can try and dig it up. The device name part is blank right now because I’m only testing out the scanning function. Thanks!

---

<div class="post-metadata">

**Author:** ![eddie.rebehy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eddie.rebehy/32/67993_2.png) [@eddie.rebehy](https://community.thunkable.com/u/eddie.rebehy)\
**Post date:** [July 30, 2020, 9:38am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/6 "2020-07-30T09:38:38Z")

</div>

hi @rariac,

I just duplicated these simple blocks and it works for me. Are you getting a mac list if you swap Device Names with Device Ids?

I’m starting to wonder if you have a hardware issue. Can you install BLE scanner or a similar app and check for signals on that as well.

---

<div class="post-metadata">

**Author:** ![rariac](https://avatars.discourse-cdn.com/v4/letter/r/bc79bd/32.png) [@rariac](https://community.thunkable.com/u/rariac)\
**Post date:** [August 5, 2020, 5:42am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/7 "2020-08-05T05:42:45Z")

</div>

hi @eddie.rebehy!

I don’t know what a mac list is, but after switching the blocks around I’m still not getting any output.

I can’t download anything at the moment but I will update you about the BLE scanner once I get wifi.

---

<div class="post-metadata">

**Author:** ![eddie.rebehy](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eddie.rebehy/32/67993_2.png) [@eddie.rebehy](https://community.thunkable.com/u/eddie.rebehy)\
**Post date:** [August 5, 2020, 6:40am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/8 "2020-08-05T06:40:35Z")

</div>

hi @rariac

I’ll let you do your own research on this but In simple terms, mac address is a unique number that is used to identify the ble device. scanning for names may show blank lines if a device is advertising without a name but it will always have a mac address and hence you can see if a device is being scanned or not even if no name exists. Get things working with macs (ID) before you worry about names.

the ble scanner apps will allow you to scan, connect, read and write to a device independant to Thunkable so you can rule out code errors or bugs before debugging.

good luck.

---

<div class="post-metadata">

**Author:** ![cpreet.chawlal](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@cpreet.chawlal](https://community.thunkable.com/u/cpreet.chawlal)\
**Post date:** [February 16, 2021, 5:15pm UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/9 "2021-02-16T17:15:09Z")

</div>

So i was trying to do the same thing with the BLE component.  
These are the blocks that i am using

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/a/8aa4ee52287196657cb4ebff6920a784246637d6.png)  
The error messages i get are as follows,

> BleError: BluetoothLE is powered off

i turn on bluetooth

> BleError: Location Services are disabled

i turn on gps  
The message stays put on the screen for 3~4 clicks of the scan button and then changes to

> BleError: Cannot start scanning operation

After this i have tried the basics  
(reinstalling the app, turning bluetooth off and on again, clearing paired devices, downloading it as an app and then trying the steps)  
The only suspicion I have is that the live demo app does not ask for bluetooth permissions (if there are any). I have looked into it but they do not contain bluetooth permissions.  
Please do give a lead on how to solve the same problem, or if there is a workaround for the same

---

<div class="post-metadata">

**Author:** ![tpirowski](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tpirowski/32/165528_2.png) [@tpirowski](https://community.thunkable.com/u/tpirowski)\
**Post date:** [January 15, 2023, 8:48am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/10 "2023-01-15T08:48:06Z")

</div>

I have written my apk with MIT Inventor using “AddressesAndNames” scan and it works within 2 seconds delivering pairs of MAC & Name. Just works, as it should to.  
Thunkable was my first choice, but when I cannot scan names (MACs are scanned, names empty) - complete BLE function in Thunkable is useless for me.  
If you have any workabout to give Thunkable same functionality, as MIT App Inventor - plz help me.

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [July 11, 2024, 11:07am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/11 "2024-07-11T11:07:57Z")

</div>

A post was split to a new topic: [BLE + Location Issue](https://community.thunkable.com/t/ble-location-issue/3095162)

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [July 11, 2024, 11:18am UTC](https://community.thunkable.com/t/ble-scan-function-not-working/708420/12 "2024-07-11T11:18:35Z")

</div>


