dotnet-bluetooth-le
dotnet-bluetooth-le copied to clipboard
Scanning only finds results on some devices and versions
Here is a link to the standalone GitHub repo where I have the code I am running.
Steps to reproduce
-
Run the application linked above on an Android 10 device (preferably a Samsung Tablet) using Visual Studio 2019
-
Look at the debug output
Expected behavior
The scan should result in the DeviceDiscovered callback being called and the message "Device Discovered!!!!!" followed by the name of the device printed out on the debug output window. I have a specific device I am trying to connect to or at least discover.
Actual behavior
The scanner keeps rescanning and rescanning and never actually finds a single device.
Crashlog
Runtime error, no crashes.
Configuration
Version of the Plugin: 2.1.2
Platform: Android 10
Device: Samsung SM - T830 tablet
Further information
I have tried this app on my phone, an LG V30 running Android 9 and it works perfectly. However, when I attempt to use it on the Samsung tablet it doesn't work at all. I've looked extensively into this issue on StackOverflow and this GitHub's issues but haven't found this exact situation or a solution anywhere. My AndroidManifest.xml includes all of the required permissions for Android 10 bluetooth...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="[redacted]">
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29"/>
<application android:label="FCA_Grenlite.Android" android:theme="@style/MainTheme"></application>
<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.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
</manifest>
I set the min SDK version to 29 as well to make sure it was using the new Android 10 BACKGROUND_LOCATION permission.
This issue has been plaguing the project I'm working on for weeks and I've run out of options to try on my own -- I need help! If you require any more information please let me know and I will provide it asap.
Also note that the actual application is blank and everything I'm trying to do is taking place in the Visual Studio "Output" tab using the System.Diagnostics.Debug interface.
The only other pertinent information is that the tablet I am currently working on is refurbished, so it's entirely possible it is a hardware issue. It has worked on the same model and I believe on this exact one in the past however. This issue popped up a while ago even before I updated the tablet to Android 10 though. On the other hand, apparently this same issue is happening on other brand new tablets of the same model as well. So it's a fairly sticky situation where it worked before: there's still a chance it's a hardware issue, but it's most likely a version/sdk/api/library version issue because the tablet can see the bluetooth device I want to pair to if I go to bluetooth settings. The fact that it runs fine on my phone makes me think it's not a code bug related to anything I've written, so I just wanted to post this here if anyone might be able to help/make sense of this whole mess.
Thanks for any help you can provide, Duncan
Hi @TheDunco,
I'm the friendly issue checker. Thanks for using the issue template :star2: I appreciate it very much. I'm sure, the maintainers of this repository will answer, soon.
Try to remove this line from the manifest.
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"
I guess after it will work everywhere.
Also remember to have GPS sensor ON.
I'll give it a try. I'm not currently able to work on this project but thanks for your feedback!