Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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;
        }