Please read 
http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html
and notice that getDefaultAdapter() returns a real Adapter only if
Bluetooth support exists. If Bluetooth support exists, but is turned
off, then getState() returns STATE_OFF.

At least that is the way it is supposed to work: I have vague memories
of getDefaultAdapter() returning null when the adapter was turned off
on my T-mobile G2. But I can't vouch for that, and am not taking out
the time to test for it now.

There is a broadcast action you can wait for: ACTION_STATE_CHANGED.
Wait for this and then check to see what it changed to: on or off.

On Dec 23, 11:15 am, martien huijsmans <[email protected]>
wrote:
> Hi,
>
> I have a implemented a Android service which start a Bluetooth server.
> This is based on the example "Connecting as a server" as found 
> onhttp://developer.android.com/guide/topics/wireless/bluetooth.html.
>
> How can I detect if Bluetooth if is turned on by the user?
> Is there a notification in Adroid that my service can subscribe to?
> In my current implementation I periodically poll the BluetoothAdapter
> as shown below
> itsBTAdapter.isEnabled().
>
> Regards Martien

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to