AndroidLEDcontrol
AndroidLEDcontrol copied to clipboard
AVAILABLE DEVICES can't show my device.
ArduDroid app can show my device.
But your app cannot.
What can I do?
Did you try add permission on AndroidManifest.xml file?
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
and you need to add this in MainActivity.java. I add them in onCreate() function.
Services running on Android 10 and higher cannot discover Bluetooth devices unless they have the ACCESS_BACKGROUND_LOCATION permission. See https://developer.android.com/guide/topics/connectivity/bluetooth
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (ContextCompat.checkSelfPermission(baseContext,
Manifest.permission.ACCESS_BACKGROUND_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(
MyActivity.this,
new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION},
PERMISSION_CODE)
}
}