C# Android蓝牙:不发现手机

C# Android蓝牙:不发现手机,c#,bluetooth,xamarin.android,android-bluetooth,C#,Bluetooth,Xamarin.android,Android Bluetooth,根据指南,我创建了一个应用程序,可以查找附近的蓝牙设备,并将其名称(如果可用)、地址和rssi记录到一个简单的列表视图中 我的目标是过滤结果,找到附近所有可发现的手机及其RSSI。但是,我没有看到我的iPhone与附近的其他设备一起出现在列表中。我通过设置->常规->关于知道我手机的MAC地址,并且我的手机有 我的手机离设备大约有一英尺远,所以设备应该能够把它捡起来(它可以在房间的另一边发现我的笔记本电脑)。如何确保找到我的手机和其他手机 注意:我正在为Android版本6.0.1开发c#和Xa

根据指南,我创建了一个应用程序,可以查找附近的蓝牙设备,并将其名称(如果可用)、地址和rssi记录到一个简单的列表视图中

我的目标是过滤结果,找到附近所有可发现的手机及其RSSI。但是,我没有看到我的iPhone与附近的其他设备一起出现在列表中。我通过设置->常规->关于知道我手机的MAC地址,并且我的手机有

我的手机离设备大约有一英尺远,所以设备应该能够把它捡起来(它可以在房间的另一边发现我的笔记本电脑)。如何确保找到我的手机和其他手机

注意:我正在为Android版本6.0.1开发c#和Xamarin.Android

更新: 这是我用来进行发现的代码-

static int REQUEST_ENABLE_BT = 1;
BluetoothBroadcastReceiver btReceiver;
BluetoothAdapter btAdapter = BluetoothAdapter.DefaultAdapter
//check status of bluetooth and enable if possible
...
//Discover bluetooth devices
btReceiver = new BluetoothBroadcastReceiver(this);
IntentFilter filter = new IntentFilter(BluetoothDevice.ActionFound);
RegisterReceiver(btReceiver, filter);
btAdapter.StartDiscovery();
//custom BroadcastReceiver to take ActionFound
public class BluetoothBroadcastReceiver : BroadcastReceiver
    {
        Activity activity;
        public BluetoothBroadcastReceiver(Activity activity)
        {
            this.activity = activity;
        }
        public override void OnReceive(Context context, Intent intent)
        {
            string action = intent.Action;
            if (BluetoothDevice.ActionFound.Equals(action))
            {
                //Discovery has found a device. Get info
                BluetoothDevice device = (Android.Bluetooth.BluetoothDevice)intent.GetParcelableExtra(BluetoothDevice.ExtraDevice);
                string deviceName = device.Name;
                string deviceAddress = device.Address;
                short RSSI = intent.GetShortExtra(BluetoothDevice.ExtraRssi,(short)0);
                string result = deviceName + " " + deviceAddress + " " + RSSI;
                newDevicesArrayAdapter.Add(result);
            }
        }
    }

谢谢

上面的代码对于发现处于“可发现”模式的附近设备是正确的。然而,在手机被导航到蓝牙设置页面之前,手机似乎是无法被发现的


至少不是iPhone 7/8或三星Galaxy S8

请发布您的发现代码attempt@Amritkumar请看上面!请注意,这是在“活动”中,OnReceive会输出添加到列表视图中的设备,但我没有包含这部分代码。这表示手机只能在其蓝牙设置页面中被发现。我用手机尝试过,“当蓝牙设置打开时,附近的设备可以看到Nexus 5X。”