I have written code to enable and disable various things programatically like Wifi, Ringer modes, Airplane modes. All things that you would see in a power toggle widget.
The one that I have not found out开发者_运维百科 how to do is bluetooth. It appears that in SDK level 3 (OS 1.5) there is no pretty bluetooth manager class. Has anyone pinpointed any good source examples on enabling and disabling bluetooth that will also be forwards compatible with users running 2.0 (Droid) / 2.1 (Nexus)?
I have found a few partial examples in my google searches that I could not get to actually run.
Thanks!
http://developer.android.com/guide/topics/wireless/bluetooth.html
This has alot of great examples and teaches you the basic gist of starting up bluetooth and getting sockets.
You should probably read the whole thing but just for a quick starter look at the section called "Setting Up Bluetooth"
精彩评论