title: Android Bluetooth Headset Transition
body: <p>How exactly does Android handle the transition to a bluetooth headset when the connection is made? With the default music application, my device stops the audio from coming out the speaker, then routes it to the headphones as soon as a connection is made. When turning off the bluetooth headset, the device immediately detects the lost connection and starts routing through the device speaker again. Is this handled by the Android OS or by the application itself?</p>
  
  <p>I ask because I am working on an app that plays streams off the internet. My app only behaves as described above 50% of the time. Sometimes when connecting the bluetooth headphones the audio does not automatically switch until I stop the output and start it again. The same goes for a disconnection. The device detects that the headphones are gone, but my audio does not automatically return back through the speakers until I restart the stream.</p>