Hi.
I wanted my application to know when the bluetooth of the device is turned 
on and when it has been turned off.

I register the receiver intentfilter

IntentFilter i = new IntentFilter();
i.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
bluetooth_manager.registerReceiver(receiver, i);

in the receiver objects class, I wrote this:

String action = intent.getAction();
if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {
        Log.d(TAG,"Bluetooth State Changed");
String state = intent.getStringExtra(BluetoothAdapter.ACTION_STATE_CHANGED);
Log.d(TAG,"State: "+state);
}

When I turn my bluetooth on or off, my log shows me Bluetooth State Changed.

But the State always comes a null.

Can someone help?

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

Reply via email to