/** * Create a BluetoothA2dp proxy object for interacting with the local Bluetooth A2DP service. * * @param c Context */ public BluetoothA2dp(Context c) { mContext = c; IBinder b = ServiceManager.getService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE); if (b != null) { mService = IBluetoothA2dp.Stub.asInterface(b); } else { Log.w(TAG, "Bluetooth A2DP service not available!"); // Instead of throwing an exception which prevents people from going // into Wireless settings in the emulator. Let it crash later when it is actually used. mService = null; } }
/** Create a BluetoothA2dp proxy object for interacting with the local Bluetooth A2DP service. */ /*package*/ BluetoothA2dp(Context mContext, ServiceListener l) { IBinder b = ServiceManager.getService(BluetoothA2dpService.BLUETOOTH_A2DP_SERVICE); mServiceListener = l; mAdapter = BluetoothAdapter.getDefaultAdapter(); if (b != null) { mService = IBluetoothA2dp.Stub.asInterface(b); if (mServiceListener != null) { mServiceListener.onServiceConnected(BluetoothProfile.A2DP, this); } } else { Log.w(TAG, "Bluetooth A2DP service not available!"); // Instead of throwing an exception which prevents people from going // into Wireless settings in the emulator. Let it crash later when it is actually used. mService = null; } }