Detecting when a Bluetooth connection has been lost.

pmarloz

New Member
Licensed User
Longtime User
Hello to everybody.
I always forget to take out my pendrive when i'm at school or in public computers and that's why i've lost many of them.
To solve this i'm planning to solder a bluetooth module like this one Wireless Bluetooth Transceiver Slave Module PCB Adapter to the pendrive so that every time i plug the pendrive, the bluetooth module connects with my Desire, and if i forget to unplug it and i abandon it in the computer (more than 10 meters), and the phone detects that the connection is lost, and plays an alarm.

The hardware part is tested and working well and now i have to make the software for my phone.
What is easier?
- To make a program running always in bakground that detects when the connection is lost after having been stablished?
- or to make a program that is launched automatically every time a connection is lost and play an alarm? (even if it wasn't my pendrive, but the car's handsfree)

Regards
 

pmarloz

New Member
Licensed User
Longtime User
Hello Erel. i'm very pleased to talk with you.

I was thinking in a "resident" program (does that exist in android?) that checks the list of paired devices every, let's say, 30 seconds.

Dim PairedDevices As Map
PairedDevices = Serial1.GetPairedDevices
Dim l As List
l.Initialize
For i = 0 To PairedDevices.Size - 1
l.Add(PairedDevices.GetKeyAt(i))
Next

If the device is initially detected and then, later, it's not detected, then play an alarm.

Is there a way to have this program running always in bakground? ¿is there an "autoexec.bat" in android?
 
Upvote 0
Top