Bluetooth Error 507

I'm running this code on my Android 6.0.1 phone. When it makes a connection to my Prius' MAC (disguised...), I want to hear, "You're good to go". It does pass the pairing test, but I never hear the desired sentence. I get "Error 507: Unable to connect. Is the device turned on?” instead. Settings on both devices show a good pairing, and the Prius Bluetooth works fine with my phone for calls.



It's possibly because you do not stop the timer (!), but more likely that a connection really isn't made. Ensure that your phone has location switched on.

How do you know pairing was a success? I suggest using a label or notifier to update on each stage of your process, so you really know what has/hasn't happened.

My apologies: I didn't think showing my timer STOP button was pertinent...
Phone Location has always been ON, and I did use a notifier during test to confirm the pairing. (I wish there was a way to single-step through App Inventor code...)

The Timer should disable itself to ensure it is not repeated if the connection is made - otherwise it will try to repeat the connection.

Did you test with a status label?

Usually, the App User would select the device to connect to from a list of devices found. We have not seen all of your code so that's another story.

Here is an example of how to find out if what you expect to happen is happening:

GoodToGo.aia (3.3 KB)

1 Like

Thanks again, Chris. Yes, I have successfully used the list picker in other apps, but since I only need to connect to one device for this app, I wanted to use a hard-coded MAC.

Using your code I should be able to get the connection message to happen, but that will still leave me with another problem. The purpose of this little app was to keep me from forgetting to take my phone when I leave in the car. (All sorts of paper notes have failed...) The way it should work is that when I boot my phone in the morning, the auto-started app will lie semi-dormant until the phone detects that the car's Bluetooth has been powered and then give me the "good to go" message.

I realized today however, that the other part of the problem is the Error 507 message (showing on ALL phone screens) that occurs every time the clock ticks, until the car's Bluetooth is detected. My initial thought for that part of the problem was to use the App Inventor equivalent of "on error resume next", but I have not found a way to do that.

I will keep flogging the problem. I think you've gotten me a lot closer to the end. Thanks!

Have you tested that part? Usually, if an App is to run in the background, Android Background Services are required. Unfortunately, App Inventor does not support them. If you just leave the App running, it will drain the battery.

Since the success/fail messages just go to a label, it doesn't matter if the are repeated.

Logic: If forgetting to take your phone with you is the issue, can you be sure to remember to run the App?

If your vehicle has an Android based Sat-Nav, you could write an App for that, such that when you start the Car and the Sat Nav switches on, it can ask "Have you got your phone?"

I'm using an Android app called "Auto Start" to launch my app on boot, and it does, after several minutes instead of the few seconds I had expected. So all I have to do is remember to turn on my phone, which has not, yet, been a problem... My lowly Prius does not have Sat-Nav.

I confirm that this code removes "Error 507" if you provide the mac address.

1 Like