My BLE app stops discovering devices on one phone but works on another

I am new to MIT inventor and I am developing an app on a Motorola Moto E, android version 6 phone, to collect and store UART data from an arduino using an Adafruit Bluefruit LE SPI Friend.
I have been working on this for a couple of days but now the app, which seems to download and refresh to the App Inventor 2 companion, does not now discover BLE devices.
If however, on the same phone, I use the Nordic nRF Connect app I can see the Bluefruit BLE and its services and connect to it.

I started my development by modifying several example apps which did work but now don’t:

I have tried re-installing the companion app and I also did a factory reset of the phone.

I have another identical Moto E phone and a Samsung tablet and my app works ok when installed on these.

I am baffled, any suggestions please?


That's interesting. We have had two other people I know of using the Bluefruit but neither got it to work. Check for differences between the Moto E's - are they running identical Android versions for instance? Is Fine Location enabled on the one that does not work?

The phone on which my app did work but now doesn’t, is an Android 6.0
On this phone the options for Location Mode are:

  • High Accuracy use GPS, WiFi, Bluetooth or Mobile Networks.

  • **Battery Saving ** use WiFi, Bluetooth or Mobile Networks.

  • Device only Use GPS.

I tried them all but still cant see any BT devices.

The phone on which my app now works is an Android 5.0.2. with Location Mode set to high accuracy.

I don’t suspect the Adafruit BLE as when my app was working I saw about 8 devices listed in my location and now none.

PS I saw on your web page an app “StreamDataToFile” which looks like the core of what I want to do but I cannot get it to work on any of my devices, I will explore more tomorrow.

I think my problems are associated with updating the BluetoothLE extension but I don’t understand why.
An explanation of what I did may be of interest:
My first MIT app I built following the online instructions which included downloading and installing the latest BluetoothLE extension. This app worked fine.
The next app I developed by downloading the BluefruitLEDcontroller.aia file and then modifying it. All went well for about a day and half then this app stopped finding BLE devices. I then went back to my first app and that had now stopped functioning as well. At this stage I switched to a second phone and both apps work on that.
I cant remember all the stages but at some point the BluefruitLEDcontroller.aia app on my phone froze and the only way out was to uninstall then reinstall the MIT companion, is this where things went wrong?
I then deleted the BluefruitLEDcontroller.aia app I had been working on and re-installed it but I noticed that the BluetoothLE extension was version 2 so I deleted the extension (without heeding the consequences of the message about all block references being removed) and installed the latest extension. This obviously didn’t work so I deleted and reinstalled the app again but this time I selected import extension and then it showed updating. From this point everything has been working ok.

So I am not sure what is going on, I assumed that because I had downloaded and installed the latest BluetoothLE extension at the beginning of my developments that it was always applied in any future or past app I developed but when I start a new app I have to go through the process of installing the BluetoothLE extension again.
Is a reference to the extension saved in my AI2 companion which might explain why the app worked on one phone and not the other because each companion had a reference to a different extension.
Anyway, hopefully I can now move forward.

You have performed some outstanding detective work there Jimbo. The way earlier BLE extensions were defined means that they are not updateable - so they have to be removed first, then the new extension installed. Future BLE updates should "just update". The trick with the older versions is to copy all blocks to the BackPack, clear the blocks from the work area (except one, not related to BLE), install the new BLE extension, restore the blocks from the BackPack.

Where did you find the BluefruitLEDcontroller.aia file?

The BluefruitLEDcontroller.aia file from here:

Thanks for the help, I will follow your advice.
Your web has some very interesting stuff as well, I am working through it.


aha - gerrikoio is one of our own - a Power User :sunglasses:

Sometimes you can end up with two copies of the BluetoothLE extension in the project because we changed the internal name from version 2 to the later versions. You may want to poke around the AIA and see if there are two copies of the extension interfering with one another if the issue persists.


OK ewpatton, thanks for the advice, I will look out for that.


I now know what was happening.
As suggested by gerrikoio in the BluefruitLEDcontroller.aia description I used nRF connect without researching what the app does. I saw my BLE and hit connect to test whether my sending BLE would connect. Then I hit disconnect and assumed that the app had disconnected. I recently performed the same operation but now noticed that on my phone the nRF connect app was still running so I started to investigate.
What I should have done when disconnecting was to either hit the X beside my BLE connection or the back button on my phone.
Hopefully problem now solved.

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