I have an app that uses bluetooth SPP (RFCOMM) to communicate with a piece of hardware. The app and the bluetooth connection work great. The problem is when another app is started that also uses SPP and then one of the apps is stopped. Once either of the apps is stopped, either by quitting the app or by using a task killer, the phone slows down to a near halt. Most of the time I have to pull the battery.
I have seen this with Pandora, which uses SPP, probably as part of its Ford Sync support, and with my app. I have also seen this with the sample apps for SPP. It doesn't matter which apps I use. Any two apps that use SPP cause this.
I have seen this on Android 2.1, HTC device on ATT. I did not see this on a Motorola Droid running 2.2.1 stock, however I did see this on the same phone while running 2.2 and LFY 1.95 ROM with a custom kernel.
I have logs from the debugger if anyone needs to see them, but I see nothing in there that points out the problem. Once either SPP apps is stopped the slow down starts immediately. I still get logs but nothing at all indicating a problem. The slow dow开发者_开发知识库n does not stop until the phone is rebooted.
OK I'm just going to blame this problem on HTC. Seems like HTC devices running Android 2.1 have a very buggy Bluetooth stack. There are lots of complaints on HTC's forums about bluetooth issues.
I was able t work around this by closing my SPP connection when my app is pushed to the background then restarting the SPP connection when my app comes back up.
I don't want to do this because a future version of my app will need a SPP connection even when the app is in the background. I just hope HTC fixes their buggy software before I implement this.
If anyone has more info on HTC's buggy bluetooth stack and the inability for HTC devices to handle more than 1 SPP connection please post.
精彩评论