Bluetooth Scanning Not working Android Application tested in actual mobile device

2021-03-04T08:27:44.847+00:00

Hi

I am building the application to communicate with mobile device through bluetooth, however scanning the device is not working and not returning the devices.

I am using Plugin.BluetoothBLE

Sample code :
adapter.ScanExtra().Subscribe(scans => {
adapter.StopScan();
scanResults = scans;
scanResults.Device.WhenConnected().Subscribe(result => Connected(result));
scanResults.Device.WhenAnyCharacteristicDiscovered().Subscribe(result => CharacteristicsDiscovered(scans,result));
scanResults.Device.WhenStatusChanged().Subscribe(status => StatusChanged(scans,status));
scanResults.Device.WhenConnectionFailed().Subscribe(failure => ConnectionFailed(failure));
ConnectionConfig config = new ConnectionConfig
{
AndroidConnectionPriority = ConnectionPriority.High,
AutoConnect = true

            };

           // scanResults.Device.PairingRequest("1234");
            scanResults.Device.ConnectWait(config);


        });

Added user permission as well

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH_PRIVILEGED" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.things.permission.MANAGE_BLUETOOTH" />

please let me know any thing i missed from my end

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,298 questions
{count} votes