Code example for BluetoothHeadset

Methods: stopVoiceRecognition

0
 
        if (mBluetoothHeadset != null)
        { 
            // Need to call stopVoiceRecognition here when the app 
            // change orientation or close with headset still turns on. 
            mBluetoothHeadset.stopVoiceRecognition(mConnectedHeadset);
            mContext.unregisterReceiver(mHeadsetBroadcastReceiver);
            mBluetoothAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset);
            mBluetoothHeadset = null;
        } 
    } 
 
    /** 
     * Broadcast receiver for API < 11 
     * Handle headset and Sco audio connection states. 
     */ 
    private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver()
    { 
        @SuppressWarnings({"deprecation", "synthetic-access"}) 
        @Override 
        public void onReceive(Context context, Intent intent)