question

SubashSubramaniNaranamalpuramHarih-0017 avatar image
0 Votes"
SubashSubramaniNaranamalpuramHarih-0017 asked ·

Bluetooth Scanning Not working Android Application tested in actual mobile device

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

dotnet-xamarinformsdotnet-android
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, did you request these permissions at runtime? You could click the 'Project Site' on the below link to view the document and check the function code of the sample.
https://www.nuget.org/packages/Plugin.BluetoothLE/

0 Votes 0 ·

0 Answers