Sunday, January 23, 2011

[android-developers] Detect bluetooth headset status changes

Hi,

I'm trying to launch my app when a BT headset is connected to the
device although I haven't succeded.

In the manifest I have:

<receiver android:name=".BluetoothNotificationReceiver"
android:enabled="true">
<intent-filter>
<action
android:name="android.bluetooth.intent.action.HEADSET_STATE_CHANGED" /
>
</intent-filter>
</receiver>

and a class:

public class BluetoothNotificationReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent arg1) {
Toast.makeText(context, "This is a test.\n",
Toast.LENGTH_LONG).show();
}
}

But nothing happens when I connect or disconnect the BT headset
besides the system headset plug message.
What am I doing wrong?

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate