views:

441

answers:

1

I am trying to write a simple android application to toggle a users bluetooth connection. I would like a single application that can work on all versions of Android 1.5+.

I am aware that the Android 2+ API officially added support for bluetooth however if I am targeting a SDK level of 3 (android 1.5) then I don't get access to the official BluetoothAdapter classes.

I have seen some examples on the web that use reflection and this will work on 1.5 and 1.6 but not 2.0.

I have also seen the following unoffical bluetooth API's however neither of their example apps (available in the market as "Bluetooth Samples" and "backport-android-bluetooth") work on my Nexus One.

http://code.google.com/p/android-bluetooth/ http://code.google.com/p/backport-android-bluetooth/

Does anyone have some sample code that will work on ALL versions of Android?

I know it is possible to achieve bluetooth toggling in a single app and for versions 1.5+ because there are many applications on the market, that I have tested and are able to achieve this.

Any help is really appreciated and thanks for reading.

NOTE: Please don't just suggest writing separate apps targeting different versions, this is not what I am trying to achieve.

A: 

I see an article "Android Bluetooth Hacking using the NDK". Maybe it's help to you. URL is: http://blog.bruary.net/2009/07/android-bluetooth-hacking-using-ndk.html

I'm working on this bluetooth things too. If you have some other good idea, please share it here. thanks.

Fakebear