public void addBluetoothRoute ( ) { updateBluetoothAudioRoute ( BLUETOOTH_DEVICE_NAME ) ; if ( RuntimeEnvironment . getApiLevel ( ) <= JELLY_BEAN_MR1 ) { ReflectionHelpers . callInstanceMethod ( MediaRouter . class , realObject , "selectRouteInt" , ClassParameter . from ( int . class , MediaRouter . ROUTE_TYPE_LIVE_AUDIO ) , ClassParameter . from ( RouteInfo . class , getBluetoothA2dpRoute ( ) ) ) ; } else { realObject . selectRoute ( MediaRouter . ROUTE_TYPE_LIVE_AUDIO , getBluetoothA2dpRoute ( ) ) ; } }
Adds the Bluetooth A2DP route and ensures it s the selected route simulating connecting a Bluetooth device .