Ejemplo n.º 1
0
        // It registers bluetooth receiver - for scanning and discovery of classic bluetooth devices
        private void SubscribeToBluetooth()
        {
            if (_receiver == null)
            {
                _receiver = new BluetoothReceiver();
            }

            RegisterReceiver(_receiver, new IntentFilter(BluetoothDevice.ActionFound));
        }
Ejemplo n.º 2
0
        // It registers bluetooth receiver - for scanning and discovery of classic bluetooth devices
        private void SubscribeToBluetooth()
        {
            if (_receiver == null)
            {
                _receiver = new BluetoothReceiver();
            }

            RegisterReceiver(_receiver, new IntentFilter(BluetoothDevice.ActionFound));
            RegisterReceiver(_receiver, new IntentFilter(BluetoothAdapter.ActionDiscoveryStarted));
            RegisterReceiver(_receiver, new IntentFilter(BluetoothAdapter.ActionDiscoveryFinished));
        }
Ejemplo n.º 3
0
        // It unregisters listeners and resets the classic bluetooth receiver
        private void UnsubscribeFromBluetooth()
        {
            cancelScanning();

            if (_receiver != null)
            {
                UnregisterReceiver(_receiver);
            }

            _receiver = null;
            devices   = null;
        }