Controlling Bluetooth
Posted: 04 Jan 2013 16:48
At last I've found an app which will control Bluetooth properly on my HTC Desire, without crashing it.
I need to connect my phone via BT to 3 cars with different 'Parrot' hands-free systems, 2 cars with in-built hands-free systems, as well as a BT headset, and I would get in a car and forget to switch BT on, and later forget to switch it off again. In the end, I used to leave Bluetooth on the phone turned on all the time.
I devised a number of flows, the main one of which is a 'timed' flow which turns BT on every 6 minutes, and waits for a further 1 minute to see if a BT device connects. If no device connects, BT is switched off again. If a device connects and stays connected (monitored by another flow and using global variables), BT stays on and when the timed flow runs again, it sees this and does nothing. Once the device disconnects, BT is turned off, until the timed flow executes again. When a device connects/disconnects, the phone makes a sound as a reminder.
This all works great with the 'Parrot' systems and the BT headset, but I'm still tinkering with it, as I've found that the 2 cars with built-in BT (both same car manufacturer) will scan for a BT device when the car is started, and if none is found just give up - - unlike the others which will will keep scanning. This means that with these 2 cars, if the timed flow doesn't occur just then, they never see each other. Which means I still have to remember to switch BT on manually before I start either car - which is a PITA. Now if they had car kits...
So for now I've amended the timed flow so that if it sees BT is on, but no device is connected, it will count each time it runs and then switch BT off after half an hour. Still not ideal, but in the right direction, and my battery lasts a lot longer.
I have tried using location via the cell masts, but I'm in a rural area, and visibility of my home mast comes and goes for many miles, and I've found it's not reliable enough, and using GPS will defeat the object, which is saving my battery.
I need to connect my phone via BT to 3 cars with different 'Parrot' hands-free systems, 2 cars with in-built hands-free systems, as well as a BT headset, and I would get in a car and forget to switch BT on, and later forget to switch it off again. In the end, I used to leave Bluetooth on the phone turned on all the time.
I devised a number of flows, the main one of which is a 'timed' flow which turns BT on every 6 minutes, and waits for a further 1 minute to see if a BT device connects. If no device connects, BT is switched off again. If a device connects and stays connected (monitored by another flow and using global variables), BT stays on and when the timed flow runs again, it sees this and does nothing. Once the device disconnects, BT is turned off, until the timed flow executes again. When a device connects/disconnects, the phone makes a sound as a reminder.
This all works great with the 'Parrot' systems and the BT headset, but I'm still tinkering with it, as I've found that the 2 cars with built-in BT (both same car manufacturer) will scan for a BT device when the car is started, and if none is found just give up - - unlike the others which will will keep scanning. This means that with these 2 cars, if the timed flow doesn't occur just then, they never see each other. Which means I still have to remember to switch BT on manually before I start either car - which is a PITA. Now if they had car kits...
So for now I've amended the timed flow so that if it sees BT is on, but no device is connected, it will count each time it runs and then switch BT off after half an hour. Still not ideal, but in the right direction, and my battery lasts a lot longer.
I have tried using location via the cell masts, but I'm in a rural area, and visibility of my home mast comes and goes for many miles, and I've found it's not reliable enough, and using GPS will defeat the object, which is saving my battery.